OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_delegate.h" | 5 #include "ash/accelerators/accelerator_delegate.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
10 #include "ui/base/accelerators/accelerator.h" | 10 #include "ui/base/accelerators/accelerator.h" |
11 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
12 #include "ui/wm/core/window_util.h" | 12 #include "ui/wm/core/window_util.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 namespace {} // namespace | 15 namespace {} // namespace |
16 | 16 |
17 AcceleratorDelegate::AcceleratorDelegate() { | 17 AcceleratorDelegate::AcceleratorDelegate() { |
18 } | 18 } |
19 AcceleratorDelegate::~AcceleratorDelegate() { | 19 AcceleratorDelegate::~AcceleratorDelegate() { |
20 } | 20 } |
21 | 21 |
22 void AcceleratorDelegate::PreProcessAccelerator( | |
23 const ui::Accelerator& accelerator) { | |
24 // Fill out context object so AcceleratorController will know what | |
25 // was the previous accelerator or if the current accelerator is repeated. | |
26 Shell::GetInstance()->accelerator_controller()->context()->UpdateContext( | |
27 accelerator); | |
28 } | |
29 | |
30 bool AcceleratorDelegate::ProcessAccelerator(const ui::KeyEvent& key_event, | 22 bool AcceleratorDelegate::ProcessAccelerator(const ui::KeyEvent& key_event, |
31 const ui::Accelerator& accelerator, | 23 const ui::Accelerator& accelerator, |
32 KeyType key_type) { | 24 KeyType key_type) { |
33 // Special hardware keys like brightness and volume are handled in | 25 // Special hardware keys like brightness and volume are handled in |
34 // special way. However, some windows can override this behavior | 26 // special way. However, some windows can override this behavior |
35 // (e.g. Chrome v1 apps by default and Chrome v2 apps with | 27 // (e.g. Chrome v1 apps by default and Chrome v2 apps with |
36 // permission) by setting a window property. | 28 // permission) by setting a window property. |
37 if (key_type == KEY_TYPE_SYSTEM && !CanConsumeSystemKeys(key_event)) { | 29 if (key_type == KEY_TYPE_SYSTEM && !CanConsumeSystemKeys(key_event)) { |
38 // System keys are always consumed regardless of whether they trigger an | 30 // System keys are always consumed regardless of whether they trigger an |
39 // accelerator to prevent windows from seeing unexpected key up events. | 31 // accelerator to prevent windows from seeing unexpected key up events. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (Shell::GetInstance()->GetAppListTargetVisibility()) | 75 if (Shell::GetInstance()->GetAppListTargetVisibility()) |
84 return true; | 76 return true; |
85 | 77 |
86 // Unless |target| is in the full screen state, handle reserved accelerators | 78 // Unless |target| is in the full screen state, handle reserved accelerators |
87 // such as Alt+Tab now. | 79 // such as Alt+Tab now. |
88 return Shell::GetInstance()->accelerator_controller()->IsReservedAccelerator( | 80 return Shell::GetInstance()->accelerator_controller()->IsReservedAccelerator( |
89 accelerator); | 81 accelerator); |
90 } | 82 } |
91 | 83 |
92 } // namespace ash | 84 } // namespace ash |
OLD | NEW |