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
28 void LocationIconView::OnMouseReleased(const ui::MouseEvent
& event
) {
29 if (!chrome::ShouldDisplayOriginChip())
30 page_info_helper_
.ProcessEvent(event
);
33 void LocationIconView::OnGestureEvent(ui::GestureEvent
* event
) {
34 if (!chrome::ShouldDisplayOriginChip() &&
35 (event
->type() == ui::ET_GESTURE_TAP
)) {
36 page_info_helper_
.ProcessEvent(*event
);
41 void LocationIconView::ShowTooltip(bool show
) {
43 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON
) : base::string16());