Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 197623002: [OriginChip] Show the page info bubble on the location bar icon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comment Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/search/search.h" 8 #include "chrome/browser/search/search.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 12
13 LocationIconView::LocationIconView(LocationBarView* location_bar) 13 LocationIconView::LocationIconView(LocationBarView* location_bar)
14 : page_info_helper_(this, location_bar) { 14 : page_info_helper_(this, location_bar),
15 location_bar_(location_bar) {
15 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); 16 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON));
16 LocationBarView::InitTouchableLocationBarChildView(this); 17 LocationBarView::InitTouchableLocationBarChildView(this);
17 } 18 }
18 19
19 LocationIconView::~LocationIconView() { 20 LocationIconView::~LocationIconView() {
20 } 21 }
21 22
22 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { 23 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) {
23 // We want to show the dialog on mouse release; that is the standard behavior 24 // We want to show the dialog on mouse release; that is the standard behavior
24 // for buttons. 25 // for buttons.
25 return true; 26 return true;
26 } 27 }
27 28
28 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { 29 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) {
29 if (!chrome::ShouldDisplayOriginChip() && 30 // Do not show page info if the user has been editing the location bar or the
30 !chrome::ShouldDisplayOriginChipV2()) 31 // location bar is at the NTP. Also skip showing the page info if the
31 page_info_helper_.ProcessEvent(event); 32 // toolbar-based origin chip is being shown because it is responsible for
33 // showing the page info instead.
34 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty() ||
35 chrome::ShouldDisplayOriginChip())
36 return;
37
38 page_info_helper_.ProcessEvent(event);
32 } 39 }
33 40
34 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { 41 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
35 if (!chrome::ShouldDisplayOriginChip() && 42 // Do not show page info if the user has been editing the location bar or the
36 !chrome::ShouldDisplayOriginChipV2() && 43 // location bar is at the NTP. Also skip showing the page info if the
37 (event->type() == ui::ET_GESTURE_TAP)) { 44 // toolbar-based origin chip is being shown because it is responsible for
38 page_info_helper_.ProcessEvent(*event); 45 // showing the page info instead.
Peter Kasting 2014/03/18 01:23:13 This copy-and-paste makes me think we should have
Justin Donnelly 2014/03/18 15:54:48 Done.
39 event->SetHandled(); 46 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty() ||
40 } 47 chrome::ShouldDisplayOriginChip() ||
48 (event->type() != ui::ET_GESTURE_TAP))
49 return;
50
51 page_info_helper_.ProcessEvent(*event);
52 event->SetHandled();
41 } 53 }
42 54
43 void LocationIconView::ShowTooltip(bool show) { 55 void LocationIconView::ShowTooltip(bool show) {
44 SetTooltipText(show ? 56 SetTooltipText(show ?
45 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) : base::string16()); 57 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) : base::string16());
46 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698