| Index: ash/accelerators/accelerator_dispatcher_win.cc
|
| diff --git a/ash/accelerators/accelerator_dispatcher_win.cc b/ash/accelerators/accelerator_dispatcher_win.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..46822755c8e61474567ad0c9de68b750566c7cb6
|
| --- /dev/null
|
| +++ b/ash/accelerators/accelerator_dispatcher_win.cc
|
| @@ -0,0 +1,39 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ash/accelerators/accelerator_dispatcher.h"
|
| +
|
| +#include "ash/accelerators/accelerator_controller.h"
|
| +#include "ash/shell.h"
|
| +#include "ui/aura/event.h"
|
| +#include "ui/aura/root_window.h"
|
| +#include "ui/base/accelerators/accelerator.h"
|
| +
|
| +namespace ash {
|
| +
|
| +namespace {
|
| +
|
| +const int kModifierMask = (ui::EF_SHIFT_DOWN |
|
| + ui::EF_CONTROL_DOWN |
|
| + ui::EF_ALT_DOWN);
|
| +} // namespace
|
| +
|
| +bool AcceleratorDispatcher::Dispatch(const MSG& msg) {
|
| + ash::Shell* shell = ash::Shell::GetInstance();
|
| + if (shell->IsScreenLocked())
|
| + return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(msg);
|
| +
|
| + if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) {
|
| + ash::AcceleratorController* accelerator_controller =
|
| + shell->accelerator_controller();
|
| + ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg),
|
| + ui::EventFlagsFromNative(msg) & kModifierMask);
|
| + if (accelerator_controller && accelerator_controller->Process(accelerator))
|
| + return true;
|
| + }
|
| +
|
| + return nested_dispatcher_->Dispatch(msg);
|
| +}
|
| +
|
| +} // namespace ash
|
|
|