summaryrefslogtreecommitdiffstats
path: root/ash/accelerators/accelerator_dispatcher.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-08 00:10:03 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-08 00:10:03 +0000
commit93805f36f94bd5f824cff64e2f61e24a2df16d6d (patch)
tree6405a410b8b20a37581d5617ae045c23274d2829 /ash/accelerators/accelerator_dispatcher.cc
parent58d8c71c27e4f4e832f76ee6332fdcc16b0ed42b (diff)
downloadchromium_src-93805f36f94bd5f824cff64e2f61e24a2df16d6d.zip
chromium_src-93805f36f94bd5f824cff64e2f61e24a2df16d6d.tar.gz
chromium_src-93805f36f94bd5f824cff64e2f61e24a2df16d6d.tar.bz2
message-pump: Change how MessagePumpDispatchers process events.
This patch allows a MessagePumpDispatcher to invoke the default handling of the message in the message-pump by setting the DISPATCH_DEFAULT flag on the return value from the ::Dispatch() callback. As before, the dispatcher can still request a termination of the current message-loop, but setting the DISPATCH_QUIT flag on the return value (instead of returning false). The callback can set both flags, in which case the message-loop will perform the default action, and also terminate the current loop. As a result of this, we can remove duplicate code, namely aura::DispatcherWin, and aura::Env::GetDispatcher(), that performs the same action as the default message pump. R=darin@chromium.org, sky@chromium.org Review URL: https://codereview.chromium.org/152083004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/accelerators/accelerator_dispatcher.cc')
-rw-r--r--ash/accelerators/accelerator_dispatcher.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc
index 7d29e68..646ef4f 100644
--- a/ash/accelerators/accelerator_dispatcher.cc
+++ b/ash/accelerators/accelerator_dispatcher.cc
@@ -85,11 +85,12 @@ void AcceleratorDispatcher::OnWindowDestroying(aura::Window* window) {
associated_window_ = NULL;
}
-bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) {
+uint32_t AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) {
if (!associated_window_)
- return false;
+ return POST_DISPATCH_QUIT_LOOP;
+
if (!ui::IsNoopEvent(event) && !associated_window_->CanReceiveEvents())
- return aura::Env::GetInstance()->GetDispatcher()->Dispatch(event);
+ return POST_DISPATCH_PERFORM_DEFAULT;
if (IsKeyEvent(event)) {
// Modifiers can be changed by the user preference, so we need to rewrite
@@ -100,7 +101,7 @@ bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) {
DCHECK(event_rewriter);
event_rewriter->OnKeyEvent(&key_event);
if (key_event.stopped_propagation())
- return true;
+ return POST_DISPATCH_NONE;
if (IsPossibleAcceleratorNotForMenu(key_event)) {
if (views::MenuController* menu_controller =
@@ -111,7 +112,7 @@ bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) {
#else
NOTIMPLEMENTED() << " Repost NativeEvent here.";
#endif
- return false;
+ return POST_DISPATCH_QUIT_LOOP;
}
}
@@ -127,7 +128,7 @@ bool AcceleratorDispatcher::Dispatch(const base::NativeEvent& event) {
Shell::GetInstance()->accelerator_controller()->context()->
UpdateContext(accelerator);
if (accelerator_controller->Process(accelerator))
- return true;
+ return POST_DISPATCH_NONE;
}
return nested_dispatcher_->Dispatch(key_event.native_event());