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

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

Issue 1947533003: Second try at fixing location bar icon keyboard activation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/bubble_icon_view.h" 5 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h"
6 6
7 #include "chrome/browser/command_updater.h" 7 #include "chrome/browser/command_updater.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (!event.IsLeftMouseButton()) 91 if (!event.IsLeftMouseButton())
92 return; 92 return;
93 93
94 const bool activated = HitTestPoint(event.location()); 94 const bool activated = HitTestPoint(event.location());
95 ink_drop_delegate_->OnAction( 95 ink_drop_delegate_->OnAction(
96 activated ? views::InkDropState::ACTIVATED : views::InkDropState::HIDDEN); 96 activated ? views::InkDropState::ACTIVATED : views::InkDropState::HIDDEN);
97 if (activated) 97 if (activated)
98 ExecuteCommand(EXECUTE_SOURCE_MOUSE); 98 ExecuteCommand(EXECUTE_SOURCE_MOUSE);
99 } 99 }
100 100
101 bool BubbleIconView::OnKeyReleased(const ui::KeyEvent& event) { 101 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) {
102 if (event.key_code() != ui::VKEY_SPACE && event.key_code() != ui::VKEY_RETURN) 102 if (event.key_code() != ui::VKEY_RETURN && event.key_code() != ui::VKEY_SPACE)
103 return false; 103 return false;
104 104
105 ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED); 105 ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED);
106 // As with CustomButton, return activates on key down and space activates on
107 // key up.
Peter Kasting 2016/05/04 02:21:00 Shouldn't we change the ink drop OnAction() call t
Evan Stade 2016/05/04 02:45:52 We want to show the ripple on key down for both sp
Peter Kasting 2016/05/04 02:57:40 o_O Seems, then, like the ripple is basically a "y
Evan Stade 2016/05/04 03:03:57 Perhaps "something is happening or will happen soo
108 if (event.key_code() == ui::VKEY_RETURN)
109 ExecuteCommand(EXECUTE_SOURCE_KEYBOARD);
110 return true;
111 }
112
113 bool BubbleIconView::OnKeyReleased(const ui::KeyEvent& event) {
114 if (event.key_code() != ui::VKEY_SPACE)
115 return false;
116
106 ExecuteCommand(EXECUTE_SOURCE_KEYBOARD); 117 ExecuteCommand(EXECUTE_SOURCE_KEYBOARD);
107 return true; 118 return true;
108 } 119 }
109 120
110 void BubbleIconView::ViewHierarchyChanged( 121 void BubbleIconView::ViewHierarchyChanged(
111 const ViewHierarchyChangedDetails& details) { 122 const ViewHierarchyChangedDetails& details) {
112 View::ViewHierarchyChanged(details); 123 View::ViewHierarchyChanged(details);
113 if (details.is_add && GetNativeTheme()) 124 if (details.is_add && GetNativeTheme())
114 UpdateIcon(); 125 UpdateIcon();
115 } 126 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 image_->SetImage( 204 image_->SetImage(
194 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color)); 205 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color));
195 } 206 }
196 207
197 void BubbleIconView::SetActiveInternal(bool active) { 208 void BubbleIconView::SetActiveInternal(bool active) {
198 if (active_ == active) 209 if (active_ == active)
199 return; 210 return;
200 active_ = active; 211 active_ = active;
201 UpdateIcon(); 212 UpdateIcon();
202 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698