| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
| 9 #include "ash/screenshot_delegate.h" | 9 #include "ash/screenshot_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 { ui::VKEY_F5, false, true, false, TAKE_SCREENSHOT }, | 46 { ui::VKEY_F5, false, true, false, TAKE_SCREENSHOT }, |
| 47 { ui::VKEY_PRINT, false, false, false, TAKE_SCREENSHOT }, | 47 { ui::VKEY_PRINT, false, false, false, TAKE_SCREENSHOT }, |
| 48 #if !defined(NDEBUG) | 48 #if !defined(NDEBUG) |
| 49 { ui::VKEY_HOME, false, true, false, ROTATE_SCREEN }, | 49 { ui::VKEY_HOME, false, true, false, ROTATE_SCREEN }, |
| 50 { ui::VKEY_F11, false, true, false, TOGGLE_ROOT_WINDOW_FULL_SCREEN }, | 50 { ui::VKEY_F11, false, true, false, TOGGLE_ROOT_WINDOW_FULL_SCREEN }, |
| 51 { ui::VKEY_L, false, false, true, PRINT_LAYER_HIERARCHY }, | 51 { ui::VKEY_L, false, false, true, PRINT_LAYER_HIERARCHY }, |
| 52 #endif | 52 #endif |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 bool HandleCycleWindow(bool forward) { | 55 bool HandleCycleWindow(bool forward) { |
| 56 if (aura_shell::Shell::GetInstance()->IsScreenLocked()) | 56 if (ash::Shell::GetInstance()->IsScreenLocked()) |
| 57 return false; | 57 return false; |
| 58 | 58 |
| 59 // Use the same order of the windows in LauncherModel to cycle windows. | 59 // Use the same order of the windows in LauncherModel to cycle windows. |
| 60 aura_shell::LauncherModel* model = | 60 ash::LauncherModel* model = |
| 61 aura_shell::Shell::GetInstance()->launcher()->model(); | 61 ash::Shell::GetInstance()->launcher()->model(); |
| 62 aura::Window* active_window = aura_shell::GetActiveWindow(); | 62 aura::Window* active_window = ash::GetActiveWindow(); |
| 63 if (!active_window) { | 63 if (!active_window) { |
| 64 LOG(ERROR) << "No active window"; | 64 LOG(ERROR) << "No active window"; |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 int active_index = model->ItemIndexByWindow(active_window); | 67 int active_index = model->ItemIndexByWindow(active_window); |
| 68 if (active_index < 0) { | 68 if (active_index < 0) { |
| 69 VLOG(2) << "Active window not found in the launcher model"; | 69 VLOG(2) << "Active window not found in the launcher model"; |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 int next_index = (active_index + (forward ? 1 : -1) + model->item_count()) % | 72 int next_index = (active_index + (forward ? 1 : -1) + model->item_count()) % |
| 73 model->item_count(); | 73 model->item_count(); |
| 74 aura_shell::ActivateWindow(model->items()[next_index].window); | 74 ash::ActivateWindow(model->items()[next_index].window); |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 | 77 |
| 78 #if !defined(NDEBUG) | 78 #if !defined(NDEBUG) |
| 79 // Rotates the screen. | 79 // Rotates the screen. |
| 80 bool HandleRotateScreen() { | 80 bool HandleRotateScreen() { |
| 81 static int i = 0; | 81 static int i = 0; |
| 82 int delta = 0; | 82 int delta = 0; |
| 83 switch (i) { | 83 switch (i) { |
| 84 case 0: delta = 90; break; | 84 case 0: delta = 90; break; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool HandlePrintLayerHierarchy() { | 115 bool HandlePrintLayerHierarchy() { |
| 116 ui::PrintLayerHierarchy(aura::RootWindow::GetInstance()->layer()); | 116 ui::PrintLayerHierarchy(aura::RootWindow::GetInstance()->layer()); |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 namespace aura_shell { | 123 namespace ash { |
| 124 | 124 |
| 125 //////////////////////////////////////////////////////////////////////////////// | 125 //////////////////////////////////////////////////////////////////////////////// |
| 126 // AcceleratorController, public: | 126 // AcceleratorController, public: |
| 127 | 127 |
| 128 AcceleratorController::AcceleratorController() | 128 AcceleratorController::AcceleratorController() |
| 129 : accelerator_manager_(new ui::AcceleratorManager) { | 129 : accelerator_manager_(new ui::AcceleratorManager) { |
| 130 Init(); | 130 Init(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 AcceleratorController::~AcceleratorController() { | 133 AcceleratorController::~AcceleratorController() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 return HandleToggleRootWindowFullScreen(); | 196 return HandleToggleRootWindowFullScreen(); |
| 197 case PRINT_LAYER_HIERARCHY: | 197 case PRINT_LAYER_HIERARCHY: |
| 198 return HandlePrintLayerHierarchy(); | 198 return HandlePrintLayerHierarchy(); |
| 199 #endif | 199 #endif |
| 200 default: | 200 default: |
| 201 NOTREACHED() << "Unhandled action " << it->second;; | 201 NOTREACHED() << "Unhandled action " << it->second;; |
| 202 } | 202 } |
| 203 return false; | 203 return false; |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace aura_shell | 206 } // namespace ash |
| OLD | NEW |