| 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/common/accelerators/accelerator_router.h" | 5 #include "ash/common/accelerators/accelerator_router.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "ui/base/accelerators/accelerator.h" | 12 #include "ui/base/accelerators/accelerator.h" |
| 13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Returns true if |key_code| is a key usually handled directly by the shell. | 19 // Returns true if |key_code| is a key usually handled directly by the shell. |
| 20 bool IsSystemKey(ui::KeyboardCode key_code) { | 20 bool IsSystemKey(ui::KeyboardCode key_code) { |
| 21 #if defined(OS_CHROMEOS) | |
| 22 switch (key_code) { | 21 switch (key_code) { |
| 23 case ui::VKEY_MEDIA_LAUNCH_APP2: // Fullscreen button. | 22 case ui::VKEY_MEDIA_LAUNCH_APP2: // Fullscreen button. |
| 24 case ui::VKEY_MEDIA_LAUNCH_APP1: // Overview button. | 23 case ui::VKEY_MEDIA_LAUNCH_APP1: // Overview button. |
| 25 case ui::VKEY_BRIGHTNESS_DOWN: | 24 case ui::VKEY_BRIGHTNESS_DOWN: |
| 26 case ui::VKEY_BRIGHTNESS_UP: | 25 case ui::VKEY_BRIGHTNESS_UP: |
| 27 case ui::VKEY_KBD_BRIGHTNESS_DOWN: | 26 case ui::VKEY_KBD_BRIGHTNESS_DOWN: |
| 28 case ui::VKEY_KBD_BRIGHTNESS_UP: | 27 case ui::VKEY_KBD_BRIGHTNESS_UP: |
| 29 case ui::VKEY_VOLUME_MUTE: | 28 case ui::VKEY_VOLUME_MUTE: |
| 30 case ui::VKEY_VOLUME_DOWN: | 29 case ui::VKEY_VOLUME_DOWN: |
| 31 case ui::VKEY_VOLUME_UP: | 30 case ui::VKEY_VOLUME_UP: |
| 32 case ui::VKEY_POWER: | 31 case ui::VKEY_POWER: |
| 33 return true; | 32 return true; |
| 34 default: | 33 default: |
| 35 return false; | 34 return false; |
| 36 } | 35 } |
| 37 #endif // defined(OS_CHROMEOS) | |
| 38 return false; | |
| 39 } | 36 } |
| 40 | 37 |
| 41 } // namespace | 38 } // namespace |
| 42 | 39 |
| 43 AcceleratorRouter::AcceleratorRouter() {} | 40 AcceleratorRouter::AcceleratorRouter() {} |
| 44 | 41 |
| 45 AcceleratorRouter::~AcceleratorRouter() {} | 42 AcceleratorRouter::~AcceleratorRouter() {} |
| 46 | 43 |
| 47 bool AcceleratorRouter::ProcessAccelerator(WmWindow* target, | 44 bool AcceleratorRouter::ProcessAccelerator(WmWindow* target, |
| 48 const ui::KeyEvent& key_event, | 45 const ui::KeyEvent& key_event, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 103 |
| 107 // Handle preferred accelerators (such as ALT-TAB) before sending | 104 // Handle preferred accelerators (such as ALT-TAB) before sending |
| 108 // to the target. | 105 // to the target. |
| 109 if (accelerator_controller->IsPreferred(accelerator)) | 106 if (accelerator_controller->IsPreferred(accelerator)) |
| 110 return true; | 107 return true; |
| 111 | 108 |
| 112 return WmShell::Get()->GetAppListTargetVisibility(); | 109 return WmShell::Get()->GetAppListTargetVisibility(); |
| 113 } | 110 } |
| 114 | 111 |
| 115 } // namespace ash | 112 } // namespace ash |
| OLD | NEW |