Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/ime/event.h" | |
| 8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 9 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| 10 #include "ui/aura/event.h" | 11 #include "ui/aura/event.h" |
| 11 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 12 #include "ui/base/accelerators/accelerator.h" | 13 #include "ui/base/accelerators/accelerator.h" |
| 13 #include "ui/base/events.h" | 14 #include "ui/base/events.h" |
| 14 | 15 |
| 15 namespace ash { | 16 namespace ash { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 const int kModifierMask = (ui::EF_SHIFT_DOWN | | 20 const int kModifierMask = (ui::EF_SHIFT_DOWN | |
| 20 ui::EF_CONTROL_DOWN | | 21 ui::EF_CONTROL_DOWN | |
| 21 ui::EF_ALT_DOWN); | 22 ui::EF_ALT_DOWN); |
| 22 } // namespace | 23 } // namespace |
| 23 | 24 |
| 24 bool AcceleratorDispatcher::Dispatch(const MSG& msg) { | 25 bool AcceleratorDispatcher::Dispatch(const MSG& msg) { |
|
oshima
2012/02/29 19:28:42
can you file a bug and add TODO to consolidate win
| |
| 25 if (!associated_window_) | 26 if (!associated_window_) |
| 26 return false; | 27 return false; |
| 27 if (!ui::IsNoopEvent(msg) && !associated_window_->CanReceiveEvents()) | 28 if (!ui::IsNoopEvent(msg) && !associated_window_->CanReceiveEvents()) |
| 28 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(msg); | 29 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(msg); |
| 29 | 30 |
| 30 if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) { | 31 if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN || |
| 32 msg.message == WM_KEYUP || msg.message = WM_SYSKEYUP) { | |
| 31 ash::AcceleratorController* accelerator_controller = | 33 ash::AcceleratorController* accelerator_controller = |
| 32 ash::Shell::GetInstance()->accelerator_controller(); | 34 ash::Shell::GetInstance()->accelerator_controller(); |
| 33 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg), | 35 if (accelerator_controller) { |
| 34 ui::EventFlagsFromNative(msg) & kModifierMask); | 36 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg), |
| 35 if (accelerator_controller && accelerator_controller->Process(accelerator)) | 37 ui::EventFlagsFromNative(msg) & kModifierMask); |
| 36 return true; | 38 if (accelerator_controller->Process(accelerator)) |
| 39 return true; | |
| 40 accelerator.set_type(TranslatedKeyEvent(msg, false).type()); | |
| 41 if (accelerator_controller->Process(accelerator)) | |
| 42 return true; | |
| 43 } | |
| 37 } | 44 } |
| 38 | 45 |
| 39 return nested_dispatcher_->Dispatch(msg); | 46 return nested_dispatcher_->Dispatch(msg); |
| 40 } | 47 } |
| 41 | 48 |
| 42 } // namespace ash | 49 } // namespace ash |
| OLD | NEW |