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

Unified Diff: ui/views/widget/root_view.cc

Issue 11570012: events: Update key-event handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-for-landing Created 8 years 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 | « ui/views/widget/root_view.h ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index 03dc04aedb35be306422e9f089c332a86f738dce..5b0de0bc65ef63f85f4f593c24587890e4543990 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -111,7 +111,7 @@ void RootView::NotifyNativeViewHierarchyChanged(bool attached,
// Input -----------------------------------------------------------------------
-ui::EventResult RootView::DispatchKeyEvent(const ui::KeyEvent& event) {
+void RootView::DispatchKeyEvent(ui::KeyEvent* event) {
bool consumed = false;
View* v = NULL;
@@ -119,17 +119,19 @@ ui::EventResult RootView::DispatchKeyEvent(const ui::KeyEvent& event) {
v = GetFocusManager()->GetFocusedView();
// Special case to handle right-click context menus triggered by the
// keyboard.
- if (v && v->enabled() && ((event.key_code() == ui::VKEY_APPS) ||
- (event.key_code() == ui::VKEY_F10 && event.IsShiftDown()))) {
+ if (v && v->enabled() && ((event->key_code() == ui::VKEY_APPS) ||
+ (event->key_code() == ui::VKEY_F10 && event->IsShiftDown()))) {
v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false);
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
for (; v && v != this && !consumed; v = v->parent()) {
- consumed = (event.type() == ui::ET_KEY_PRESSED) ?
- v->OnKeyPressed(event) : v->OnKeyReleased(event);
+ consumed = (event->type() == ui::ET_KEY_PRESSED) ?
+ v->OnKeyPressed(*event) : v->OnKeyReleased(*event);
}
- return consumed ? ui::ER_CONSUMED : ui::ER_UNHANDLED;
+ if (consumed)
+ event->StopPropagation();
}
void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
« no previous file with comments | « ui/views/widget/root_view.h ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698