OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ash/accelerators/accelerator_dispatcher.h" | |
6 | |
7 #include "ash/accelerators/accelerator_controller.h" | |
8 #include "ash/shell.h" | |
9 #include "base/message_loop.h" | |
10 #include "base/message_pump_win.h" | |
oshima
2012/01/31 20:42:00
aren't these two necessary?
| |
11 #include "ui/aura/event.h" | |
12 #include "ui/aura/root_window.h" | |
13 #include "ui/base/accelerators/accelerator.h" | |
14 | |
15 namespace ash { | |
16 | |
17 namespace { | |
18 | |
19 const int kModifierMask = (ui::EF_SHIFT_DOWN | | |
20 ui::EF_CONTROL_DOWN | | |
21 ui::EF_ALT_DOWN); | |
22 } // namespace | |
23 | |
24 bool AcceleratorDispatcher::Dispatch(const MSG& msg) { | |
25 ash::Shell* shell = ash::Shell::GetInstance(); | |
26 if (shell->IsScreenLocked()) | |
27 return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(msg); | |
28 | |
29 if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) { | |
30 ash::AcceleratorController* accelerator_controller = | |
31 shell->accelerator_controller(); | |
32 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg), | |
33 ui::EventFlagsFromNative(msg) & kModifierMask); | |
34 if (accelerator_controller && accelerator_controller->Process(accelerator)) | |
35 return true; | |
36 } | |
37 | |
38 return nested_dispatcher_->Dispatch(msg); | |
39 } | |
40 | |
41 } // namespace ash | |
OLD | NEW |