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

Side by Side Diff: ash/accelerators/accelerator_dispatcher_win.cc

Issue 9538015: Allows ash accelerators in wrench menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes win compile Created 8 years, 9 months 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
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 #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) {
26 // TODO(oshima): Consolidate win and linux. http://crbug.com/116282
25 if (!associated_window_) 27 if (!associated_window_)
26 return false; 28 return false;
27 if (!ui::IsNoopEvent(msg) && !associated_window_->CanReceiveEvents()) 29 if (!ui::IsNoopEvent(msg) && !associated_window_->CanReceiveEvents())
28 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(msg); 30 return aura::Env::GetInstance()->GetDispatcher()->Dispatch(msg);
29 31
30 if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) { 32 if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN ||
33 msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP) {
31 ash::AcceleratorController* accelerator_controller = 34 ash::AcceleratorController* accelerator_controller =
32 ash::Shell::GetInstance()->accelerator_controller(); 35 ash::Shell::GetInstance()->accelerator_controller();
33 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg), 36 if (accelerator_controller) {
34 ui::EventFlagsFromNative(msg) & kModifierMask); 37 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(msg),
35 if (accelerator_controller && accelerator_controller->Process(accelerator)) 38 ui::EventFlagsFromNative(msg) & kModifierMask);
36 return true; 39 if (accelerator_controller->Process(accelerator))
40 return true;
41 accelerator.set_type(TranslatedKeyEvent(msg, false).type());
42 if (accelerator_controller->Process(accelerator))
43 return true;
44 }
37 } 45 }
38 46
39 return nested_dispatcher_->Dispatch(msg); 47 return nested_dispatcher_->Dispatch(msg);
40 } 48 }
41 49
42 } // namespace ash 50 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_dispatcher_linux.cc ('k') | ash/accelerators/nested_dispatcher_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698