| OLD | NEW |
| 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_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_table.h" | 7 #include "ash/accelerators/accelerator_table.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/caps_lock_delegate.h" | 9 #include "ash/caps_lock_delegate.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 bool HandleExit() { | 76 bool HandleExit() { |
| 77 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); | 77 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); |
| 78 if (!delegate) | 78 if (!delegate) |
| 79 return false; | 79 return false; |
| 80 delegate->Exit(); | 80 delegate->Exit(); |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool HandleNewTab() { |
| 85 ash::Shell::GetInstance()->delegate()->NewTab(); |
| 86 return true; |
| 87 } |
| 88 |
| 84 bool HandleNewWindow(bool is_incognito) { | 89 bool HandleNewWindow(bool is_incognito) { |
| 85 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); | 90 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); |
| 86 if (!delegate) | 91 if (!delegate) |
| 87 return false; | 92 return false; |
| 88 delegate->NewWindow(is_incognito); | 93 delegate->NewWindow(is_incognito); |
| 89 return true; | 94 return true; |
| 90 } | 95 } |
| 91 | 96 |
| 97 bool HandleRestoreTab() { |
| 98 ash::Shell::GetInstance()->delegate()->RestoreTab(); |
| 99 return true; |
| 100 } |
| 101 |
| 102 bool HandleShowTaskManager() { |
| 103 ash::Shell::GetInstance()->delegate()->ShowTaskManager(); |
| 104 return true; |
| 105 } |
| 106 |
| 92 // Rotates the default window container. | 107 // Rotates the default window container. |
| 93 bool HandleRotateWindows() { | 108 bool HandleRotateWindows() { |
| 94 aura::Window* target = ash::Shell::GetInstance()->GetContainer( | 109 aura::Window* target = ash::Shell::GetInstance()->GetContainer( |
| 95 ash::internal::kShellWindowId_DefaultContainer); | 110 ash::internal::kShellWindowId_DefaultContainer); |
| 96 scoped_ptr<ui::LayerAnimationSequence> screen_rotation( | 111 scoped_ptr<ui::LayerAnimationSequence> screen_rotation( |
| 97 new ui::LayerAnimationSequence(new ui::ScreenRotation(360))); | 112 new ui::LayerAnimationSequence(new ui::ScreenRotation(360))); |
| 98 target->layer()->GetAnimator()->StartAnimation( | 113 target->layer()->GetAnimator()->StartAnimation( |
| 99 screen_rotation.release()); | 114 screen_rotation.release()); |
| 100 return true; | 115 return true; |
| 101 } | 116 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 return HandleFileManager(); | 323 return HandleFileManager(); |
| 309 case OPEN_CROSH: | 324 case OPEN_CROSH: |
| 310 return HandleCrosh(); | 325 return HandleCrosh(); |
| 311 case TOGGLE_SPOKEN_FEEDBACK: | 326 case TOGGLE_SPOKEN_FEEDBACK: |
| 312 return HandleToggleSpokenFeedback(); | 327 return HandleToggleSpokenFeedback(); |
| 313 #endif | 328 #endif |
| 314 case EXIT: | 329 case EXIT: |
| 315 return HandleExit(); | 330 return HandleExit(); |
| 316 case NEW_INCOGNITO_WINDOW: | 331 case NEW_INCOGNITO_WINDOW: |
| 317 return HandleNewWindow(true /* is_incognito */); | 332 return HandleNewWindow(true /* is_incognito */); |
| 333 case NEW_TAB: |
| 334 return HandleNewTab(); |
| 318 case NEW_WINDOW: | 335 case NEW_WINDOW: |
| 319 return HandleNewWindow(false /* is_incognito */); | 336 return HandleNewWindow(false /* is_incognito */); |
| 337 case RESTORE_TAB: |
| 338 return HandleRestoreTab(); |
| 320 case TAKE_SCREENSHOT: | 339 case TAKE_SCREENSHOT: |
| 321 if (screenshot_delegate_.get()) { | 340 if (screenshot_delegate_.get()) { |
| 322 aura::RootWindow* root_window = Shell::GetRootWindow(); | 341 aura::RootWindow* root_window = Shell::GetRootWindow(); |
| 323 screenshot_delegate_->HandleTakeScreenshot(root_window); | 342 screenshot_delegate_->HandleTakeScreenshot(root_window); |
| 324 } | 343 } |
| 325 // Return true to prevent propagation of the key event. | 344 // Return true to prevent propagation of the key event. |
| 326 return true; | 345 return true; |
| 327 case TAKE_PARTIAL_SCREENSHOT: | 346 case TAKE_PARTIAL_SCREENSHOT: |
| 328 if (screenshot_delegate_.get()) | 347 if (screenshot_delegate_.get()) |
| 329 ash::Shell::GetInstance()->delegate()-> | 348 ash::Shell::GetInstance()->delegate()-> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 case SHOW_KEYBOARD_OVERLAY: | 391 case SHOW_KEYBOARD_OVERLAY: |
| 373 ash::Shell::GetInstance()->delegate()->ShowKeyboardOverlay(); | 392 ash::Shell::GetInstance()->delegate()->ShowKeyboardOverlay(); |
| 374 break; | 393 break; |
| 375 case SHOW_OAK: | 394 case SHOW_OAK: |
| 376 if (CommandLine::ForCurrentProcess()->HasSwitch( | 395 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 377 switches::kAshEnableOak)) { | 396 switches::kAshEnableOak)) { |
| 378 oak::ShowOakWindow(); | 397 oak::ShowOakWindow(); |
| 379 return true; | 398 return true; |
| 380 } | 399 } |
| 381 break; | 400 break; |
| 401 case SHOW_TASK_MANAGER: |
| 402 return HandleShowTaskManager(); |
| 382 case NEXT_IME: | 403 case NEXT_IME: |
| 383 if (ime_control_delegate_.get()) | 404 if (ime_control_delegate_.get()) |
| 384 return ime_control_delegate_->HandleNextIme(); | 405 return ime_control_delegate_->HandleNextIme(); |
| 385 break; | 406 break; |
| 386 case PREVIOUS_IME: | 407 case PREVIOUS_IME: |
| 387 if (ime_control_delegate_.get()) | 408 if (ime_control_delegate_.get()) |
| 388 return ime_control_delegate_->HandlePreviousIme(); | 409 return ime_control_delegate_->HandlePreviousIme(); |
| 389 break; | 410 break; |
| 390 case SWITCH_IME: | 411 case SWITCH_IME: |
| 391 if (ime_control_delegate_.get()) | 412 if (ime_control_delegate_.get()) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 // Then set this one as active. | 534 // Then set this one as active. |
| 514 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 535 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
| 515 } | 536 } |
| 516 } | 537 } |
| 517 | 538 |
| 518 bool AcceleratorController::CanHandleAccelerators() const { | 539 bool AcceleratorController::CanHandleAccelerators() const { |
| 519 return true; | 540 return true; |
| 520 } | 541 } |
| 521 | 542 |
| 522 } // namespace ash | 543 } // namespace ash |
| OLD | NEW |