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

Side by Side Diff: ash/accelerators/accelerator_dispatcher.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/accelerators/accelerator_dispatcher.h" 5 #include "ash/accelerators/accelerator_dispatcher.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Xlib defines RootWindow 10 // Xlib defines RootWindow
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!ui::IsNoopEvent(event) && !associated_window_->CanReceiveEvents()) 67 if (!ui::IsNoopEvent(event) && !associated_window_->CanReceiveEvents())
68 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(event); 68 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(event);
69 69
70 if (IsKeyEvent(event)) { 70 if (IsKeyEvent(event)) {
71 // Modifiers can be changed by the user preference, so we need to rewrite 71 // Modifiers can be changed by the user preference, so we need to rewrite
72 // the event explicitly. 72 // the event explicitly.
73 ui::KeyEvent key_event(event, false); 73 ui::KeyEvent key_event(event, false);
74 ui::EventHandler* event_rewriter = 74 ui::EventHandler* event_rewriter =
75 ash::Shell::GetInstance()->event_rewriter_filter(); 75 ash::Shell::GetInstance()->event_rewriter_filter();
76 DCHECK(event_rewriter); 76 DCHECK(event_rewriter);
77 ui::EventResult result = event_rewriter->OnKeyEvent(&key_event); 77 event_rewriter->OnKeyEvent(&key_event);
78 if (result & ui::ER_CONSUMED) 78 if (key_event.stopped_propagation())
79 return true; 79 return true;
80 ash::AcceleratorController* accelerator_controller = 80 ash::AcceleratorController* accelerator_controller =
81 ash::Shell::GetInstance()->accelerator_controller(); 81 ash::Shell::GetInstance()->accelerator_controller();
82 if (accelerator_controller) { 82 if (accelerator_controller) {
83 ui::Accelerator accelerator(key_event.key_code(), 83 ui::Accelerator accelerator(key_event.key_code(),
84 key_event.flags() & kModifierMask); 84 key_event.flags() & kModifierMask);
85 if (key_event.type() == ui::ET_KEY_RELEASED) 85 if (key_event.type() == ui::ET_KEY_RELEASED)
86 accelerator.set_type(ui::ET_KEY_RELEASED); 86 accelerator.set_type(ui::ET_KEY_RELEASED);
87 // Fill out context object so AcceleratorController will know what 87 // Fill out context object so AcceleratorController will know what
88 // was the previous accelerator or if the current accelerator is repeated. 88 // was the previous accelerator or if the current accelerator is repeated.
89 Shell::GetInstance()->accelerator_controller()->context()-> 89 Shell::GetInstance()->accelerator_controller()->context()->
90 UpdateContext(accelerator); 90 UpdateContext(accelerator);
91 if (accelerator_controller->Process(accelerator)) 91 if (accelerator_controller->Process(accelerator))
92 return true; 92 return true;
93 } 93 }
94 94
95 return nested_dispatcher_->Dispatch(key_event.native_event()); 95 return nested_dispatcher_->Dispatch(key_event.native_event());
96 } 96 }
97 97
98 return nested_dispatcher_->Dispatch(event); 98 return nested_dispatcher_->Dispatch(event);
99 } 99 }
100 100
101 } // namespace ash 101 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698