NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / views / location_bar / location_icon_view.cc
blob9ac13a34f6a2cbb9adc4ce8a1b2fd5ec5110a84a
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/search/search.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h"
13 LocationIconView::LocationIconView(LocationBarView* location_bar)
14 : page_info_helper_(this, location_bar) {
15 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON));
16 LocationBarView::InitTouchableLocationBarChildView(this);
19 LocationIconView::~LocationIconView() {
22 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) {
23 // We want to show the dialog on mouse release; that is the standard behavior
24 // for buttons.
25 return true;
28 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) {
29 if (!chrome::ShouldDisplayOriginChip() &&
30 !chrome::ShouldDisplayOriginChipV2())
31 page_info_helper_.ProcessEvent(event);
34 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
35 if (!chrome::ShouldDisplayOriginChip() &&
36 !chrome::ShouldDisplayOriginChipV2() &&
37 (event->type() == ui::ET_GESTURE_TAP)) {
38 page_info_helper_.ProcessEvent(*event);
39 event->SetHandled();
43 void LocationIconView::ShowTooltip(bool show) {
44 SetTooltipText(show ?
45 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) : base::string16());