| 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 <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_table.h" | 9 #include "ash/accelerators/accelerator_table.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/caps_lock_delegate.h" | 11 #include "ash/caps_lock_delegate.h" |
| 12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
| 13 #include "ash/focus_cycler.h" | 13 #include "ash/focus_cycler.h" |
| 14 #include "ash/ime_control_delegate.h" | 14 #include "ash/ime_control_delegate.h" |
| 15 #include "ash/launcher/launcher.h" | 15 #include "ash/launcher/launcher.h" |
| 16 #include "ash/launcher/launcher_delegate.h" | 16 #include "ash/launcher/launcher_delegate.h" |
| 17 #include "ash/launcher/launcher_model.h" | 17 #include "ash/launcher/launcher_model.h" |
| 18 #include "ash/magnifier/magnification_controller.h" | 18 #include "ash/magnifier/magnification_controller.h" |
| 19 #include "ash/display/display_controller.h" | 19 #include "ash/display/display_controller.h" |
| 20 #include "ash/display/multi_display_manager.h" | 20 #include "ash/display/multi_display_manager.h" |
| 21 #include "ash/root_window_controller.h" | 21 #include "ash/root_window_controller.h" |
| 22 #include "ash/rotator/screen_rotation.h" | 22 #include "ash/rotator/screen_rotation.h" |
| 23 #include "ash/screenshot_delegate.h" | 23 #include "ash/screenshot_delegate.h" |
| 24 #include "ash/shell.h" | 24 #include "ash/shell.h" |
| 25 #include "ash/shell_delegate.h" | 25 #include "ash/shell_delegate.h" |
| 26 #include "ash/shell_window_ids.h" | 26 #include "ash/shell_window_ids.h" |
| 27 #include "ash/system/brightness/brightness_control_delegate.h" | 27 #include "ash/system/brightness/brightness_control_delegate.h" |
| 28 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
| 28 #include "ash/system/tray/system_tray.h" | 29 #include "ash/system/tray/system_tray.h" |
| 29 #include "ash/volume_control_delegate.h" | 30 #include "ash/volume_control_delegate.h" |
| 30 #include "ash/wm/property_util.h" | 31 #include "ash/wm/property_util.h" |
| 31 #include "ash/wm/window_cycle_controller.h" | 32 #include "ash/wm/window_cycle_controller.h" |
| 32 #include "ash/wm/window_util.h" | 33 #include "ash/wm/window_util.h" |
| 33 #include "ash/wm/workspace/snap_sizer.h" | 34 #include "ash/wm/workspace/snap_sizer.h" |
| 34 #include "base/command_line.h" | 35 #include "base/command_line.h" |
| 35 #include "ui/aura/event.h" | 36 #include "ui/aura/event.h" |
| 36 #include "ui/aura/root_window.h" | 37 #include "ui/aura/root_window.h" |
| 37 #include "ui/base/accelerators/accelerator.h" | 38 #include "ui/base/accelerators/accelerator.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 return caps_lock_delegate_->HandleToggleCapsLock(); | 439 return caps_lock_delegate_->HandleToggleCapsLock(); |
| 439 break; | 440 break; |
| 440 case BRIGHTNESS_DOWN: | 441 case BRIGHTNESS_DOWN: |
| 441 if (brightness_control_delegate_.get()) | 442 if (brightness_control_delegate_.get()) |
| 442 return brightness_control_delegate_->HandleBrightnessDown(accelerator); | 443 return brightness_control_delegate_->HandleBrightnessDown(accelerator); |
| 443 break; | 444 break; |
| 444 case BRIGHTNESS_UP: | 445 case BRIGHTNESS_UP: |
| 445 if (brightness_control_delegate_.get()) | 446 if (brightness_control_delegate_.get()) |
| 446 return brightness_control_delegate_->HandleBrightnessUp(accelerator); | 447 return brightness_control_delegate_->HandleBrightnessUp(accelerator); |
| 447 break; | 448 break; |
| 449 case KEYBOARD_BRIGHTNESS_DOWN: |
| 450 if (keyboard_brightness_control_delegate_.get()) |
| 451 return keyboard_brightness_control_delegate_-> |
| 452 HandleKeyboardBrightnessDown(accelerator); |
| 453 break; |
| 454 case KEYBOARD_BRIGHTNESS_UP: |
| 455 if (keyboard_brightness_control_delegate_.get()) |
| 456 return keyboard_brightness_control_delegate_-> |
| 457 HandleKeyboardBrightnessUp(accelerator); |
| 458 break; |
| 448 case VOLUME_MUTE: | 459 case VOLUME_MUTE: |
| 449 if (volume_control_delegate_.get()) | 460 if (volume_control_delegate_.get()) |
| 450 return volume_control_delegate_->HandleVolumeMute(accelerator); | 461 return volume_control_delegate_->HandleVolumeMute(accelerator); |
| 451 break; | 462 break; |
| 452 case VOLUME_DOWN: | 463 case VOLUME_DOWN: |
| 453 if (volume_control_delegate_.get()) | 464 if (volume_control_delegate_.get()) |
| 454 return volume_control_delegate_->HandleVolumeDown(accelerator); | 465 return volume_control_delegate_->HandleVolumeDown(accelerator); |
| 455 break; | 466 break; |
| 456 case VOLUME_UP: | 467 case VOLUME_UP: |
| 457 if (volume_control_delegate_.get()) | 468 if (volume_control_delegate_.get()) |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 void AcceleratorController::SetCapsLockDelegate( | 633 void AcceleratorController::SetCapsLockDelegate( |
| 623 scoped_ptr<CapsLockDelegate> caps_lock_delegate) { | 634 scoped_ptr<CapsLockDelegate> caps_lock_delegate) { |
| 624 caps_lock_delegate_.swap(caps_lock_delegate); | 635 caps_lock_delegate_.swap(caps_lock_delegate); |
| 625 } | 636 } |
| 626 | 637 |
| 627 void AcceleratorController::SetImeControlDelegate( | 638 void AcceleratorController::SetImeControlDelegate( |
| 628 scoped_ptr<ImeControlDelegate> ime_control_delegate) { | 639 scoped_ptr<ImeControlDelegate> ime_control_delegate) { |
| 629 ime_control_delegate_.swap(ime_control_delegate); | 640 ime_control_delegate_.swap(ime_control_delegate); |
| 630 } | 641 } |
| 631 | 642 |
| 643 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 644 scoped_ptr<KeyboardBrightnessControlDelegate> |
| 645 keyboard_brightness_control_delegate) { |
| 646 keyboard_brightness_control_delegate_.swap( |
| 647 keyboard_brightness_control_delegate); |
| 648 } |
| 649 |
| 632 void AcceleratorController::SetScreenshotDelegate( | 650 void AcceleratorController::SetScreenshotDelegate( |
| 633 scoped_ptr<ScreenshotDelegate> screenshot_delegate) { | 651 scoped_ptr<ScreenshotDelegate> screenshot_delegate) { |
| 634 screenshot_delegate_.swap(screenshot_delegate); | 652 screenshot_delegate_.swap(screenshot_delegate); |
| 635 } | 653 } |
| 636 | 654 |
| 637 void AcceleratorController::SetVolumeControlDelegate( | 655 void AcceleratorController::SetVolumeControlDelegate( |
| 638 scoped_ptr<VolumeControlDelegate> volume_control_delegate) { | 656 scoped_ptr<VolumeControlDelegate> volume_control_delegate) { |
| 639 volume_control_delegate_.swap(volume_control_delegate); | 657 volume_control_delegate_.swap(volume_control_delegate); |
| 640 } | 658 } |
| 641 | 659 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 // Then set this one as active. | 694 // Then set this one as active. |
| 677 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 695 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
| 678 } | 696 } |
| 679 } | 697 } |
| 680 | 698 |
| 681 bool AcceleratorController::CanHandleAccelerators() const { | 699 bool AcceleratorController::CanHandleAccelerators() const { |
| 682 return true; | 700 return true; |
| 683 } | 701 } |
| 684 | 702 |
| 685 } // namespace ash | 703 } // namespace ash |
| OLD | NEW |