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

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: Fix a post-merge inconsistency 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"
(...skipping 19 matching lines...) Expand all
30 page_info_helper_.location_bar()->omnibox_view()->model(); 30 page_info_helper_.location_bar()->omnibox_view()->model();
31 if (model->CanPasteAndGo(text)) 31 if (model->CanPasteAndGo(text))
32 model->PasteAndGo(text); 32 model->PasteAndGo(text);
33 } 33 }
34 34
35 // Showing the bubble on mouse release is standard button behavior. 35 // Showing the bubble on mouse release is standard button behavior.
36 return true; 36 return true;
37 } 37 }
38 38
39 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { 39 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) {
40 if (!event.IsOnlyMiddleMouseButton() && 40 if (event.IsOnlyMiddleMouseButton())
41 !chrome::ShouldDisplayOriginChip() && 41 return;
42 !chrome::ShouldDisplayOriginChipV2()) 42 OnClickOrTap(event);
43 page_info_helper_.ProcessEvent(event);
44 } 43 }
45 44
46 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { 45 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
47 if (!chrome::ShouldDisplayOriginChip() && 46 if (event->type() != ui::ET_GESTURE_TAP)
48 !chrome::ShouldDisplayOriginChipV2() && 47 return;
49 (event->type() == ui::ET_GESTURE_TAP)) { 48 OnClickOrTap(*event);
50 page_info_helper_.ProcessEvent(*event); 49 event->SetHandled();
51 event->SetHandled(); 50 }
52 } 51
52 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) {
53 // Do not show page info if the user has been editing the location bar or the
54 // location bar is at the NTP. Also skip showing the page info if the
55 // toolbar-based origin chip is being shown because it is responsible for
56 // showing the page info instead.
57 if (page_info_helper_.location_bar()->omnibox_view()->IsEditingOrEmpty() ||
58 chrome::ShouldDisplayOriginChip())
59 return;
60
61 page_info_helper_.ProcessEvent(event);
53 } 62 }
54 63
55 void LocationIconView::ShowTooltip(bool show) { 64 void LocationIconView::ShowTooltip(bool show) {
56 SetTooltipText(show ? 65 SetTooltipText(show ?
57 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) : base::string16()); 66 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) : base::string16());
58 } 67 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_icon_view.h ('k') | chrome/browser/ui/views/location_bar/page_info_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698