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

Unified Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 1915063003: Change ContentSettingImageView activation to key release (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_icon_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_icon_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc
index f1b4fc8d396218d5b32f8973a8dcc5f903ba2775..8f661434b3a7d5c0eaf941d9d04e7c0df7b03a32 100644
--- a/chrome/browser/ui/views/location_bar/location_icon_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
@@ -25,29 +25,6 @@ using content::NavigationController;
using content::NavigationEntry;
using content::WebContents;
-namespace {
-
-void ProcessEventInternal(LocationBarView* view) {
- WebContents* contents = view->GetWebContents();
- if (!contents)
- return;
-
- // Important to use GetVisibleEntry to match what's showing in the omnibox.
- NavigationEntry* entry = contents->GetController().GetVisibleEntry();
- // The visible entry can be nullptr in the case of window.open("").
- if (!entry)
- return;
-
- ChromeSecurityStateModelClient* model_client =
- ChromeSecurityStateModelClient::FromWebContents(contents);
- DCHECK(model_client);
-
- view->delegate()->ShowWebsiteSettings(contents, entry->GetURL(),
- model_client->GetSecurityInfo());
-}
-
-} // namespace
-
LocationIconView::LocationIconView(const gfx::FontList& font_list,
SkColor parent_background_color,
LocationBarView* location_bar)
@@ -105,13 +82,6 @@ bool LocationIconView::OnKeyPressed(const ui::KeyEvent& event) {
return false;
}
-bool LocationIconView::OnKeyReleased(const ui::KeyEvent& event) {
- if (event.key_code() != ui::VKEY_RETURN && event.key_code() != ui::VKEY_SPACE)
- return false;
- ProcessEvent(event);
- return true;
-}
-
void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
if (event->type() != ui::ET_GESTURE_TAP)
return;
@@ -131,17 +101,12 @@ void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) {
// location bar is at the NTP.
if (location_bar_->GetOmniboxView()->IsEditingOrEmpty())
return;
- ProcessEvent(event);
+ ProcessLocatedEvent(event);
}
-void LocationIconView::ProcessEvent(const ui::LocatedEvent& event) {
- if (!HitTestPoint(event.location()))
- return;
- ProcessEventInternal(location_bar_);
-}
-
-void LocationIconView::ProcessEvent(const ui::KeyEvent& event) {
- ProcessEventInternal(location_bar_);
+void LocationIconView::ProcessLocatedEvent(const ui::LocatedEvent& event) {
+ if (HitTestPoint(event.location()))
+ OnActivate();
}
gfx::Size LocationIconView::GetMinimumSize() const {
@@ -163,6 +128,26 @@ SkColor LocationIconView::GetBorderColor() const {
return GetTextColor();
}
+bool LocationIconView::OnActivate() {
+ WebContents* contents = location_bar_->GetWebContents();
+ if (!contents)
+ return false;
+
+ // Important to use GetVisibleEntry to match what's showing in the omnibox.
+ NavigationEntry* entry = contents->GetController().GetVisibleEntry();
+ // The visible entry can be nullptr in the case of window.open("").
+ if (!entry)
+ return false;
+
+ ChromeSecurityStateModelClient* model_client =
+ ChromeSecurityStateModelClient::FromWebContents(contents);
+ DCHECK(model_client);
+
+ location_bar_->delegate()->ShowWebsiteSettings(
+ contents, entry->GetURL(), model_client->GetSecurityInfo());
+ return true;
+}
+
gfx::Size LocationIconView::GetMinimumSizeForPreferredSize(
gfx::Size size) const {
const int kMinCharacters = 10;
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_icon_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698