| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "ui/compositor/debug_utils.h" | 46 #include "ui/compositor/debug_utils.h" |
| 47 #include "ui/compositor/layer.h" | 47 #include "ui/compositor/layer.h" |
| 48 #include "ui/compositor/layer_animation_sequence.h" | 48 #include "ui/compositor/layer_animation_sequence.h" |
| 49 #include "ui/compositor/layer_animator.h" | 49 #include "ui/compositor/layer_animator.h" |
| 50 #include "ui/oak/oak.h" | 50 #include "ui/oak/oak.h" |
| 51 #include "ui/views/debug_utils.h" | 51 #include "ui/views/debug_utils.h" |
| 52 #include "ui/views/widget/widget.h" | 52 #include "ui/views/widget/widget.h" |
| 53 | 53 |
| 54 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
| 55 #include "ash/display/output_configurator_animation.h" | 55 #include "ash/display/output_configurator_animation.h" |
| 56 #include "base/chromeos/chromeos_version.h" |
| 56 #include "chromeos/display/output_configurator.h" | 57 #include "chromeos/display/output_configurator.h" |
| 57 #endif // defined(OS_CHROMEOS) | 58 #endif // defined(OS_CHROMEOS) |
| 58 | 59 |
| 59 namespace ash { | 60 namespace ash { |
| 60 namespace { | 61 namespace { |
| 61 | 62 |
| 62 // Factor of magnification scale. For example, when this value is 1.189, scale | 63 // Factor of magnification scale. For example, when this value is 1.189, scale |
| 63 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... | 64 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... |
| 64 // Note: this value is 2.0 ^ (1 / 4). | 65 // Note: this value is 2.0 ^ (1 / 4). |
| 65 const float kMagnificationFactor = 1.18920712f; | 66 const float kMagnificationFactor = 1.18920712f; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 99 |
| 99 bool HandleCrosh() { | 100 bool HandleCrosh() { |
| 100 Shell::GetInstance()->delegate()->OpenCrosh(); | 101 Shell::GetInstance()->delegate()->OpenCrosh(); |
| 101 return true; | 102 return true; |
| 102 } | 103 } |
| 103 | 104 |
| 104 bool HandleToggleSpokenFeedback() { | 105 bool HandleToggleSpokenFeedback() { |
| 105 Shell::GetInstance()->delegate()->ToggleSpokenFeedback(); | 106 Shell::GetInstance()->delegate()->ToggleSpokenFeedback(); |
| 106 return true; | 107 return true; |
| 107 } | 108 } |
| 108 #endif | 109 void HandleCycleDisplayMode() { |
| 110 Shell* shell = Shell::GetInstance(); |
| 111 if (!base::chromeos::IsRunningOnChromeOS()) { |
| 112 internal::MultiDisplayManager::CycleDisplay(); |
| 113 } else if (shell->output_configurator()->connected_output_count() > 1) { |
| 114 internal::OutputConfiguratorAnimation* animation = |
| 115 shell->output_configurator_animation(); |
| 116 animation->StartFadeOutAnimation(base::Bind( |
| 117 base::IgnoreResult(&chromeos::OutputConfigurator::CycleDisplayMode), |
| 118 base::Unretained(shell->output_configurator()))); |
| 119 } |
| 120 } |
| 121 |
| 122 #endif // defined(OS_CHROMEOS) |
| 109 | 123 |
| 110 bool HandleExit() { | 124 bool HandleExit() { |
| 111 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 125 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
| 112 if (!delegate) | 126 if (!delegate) |
| 113 return false; | 127 return false; |
| 114 delegate->Exit(); | 128 delegate->Exit(); |
| 115 return true; | 129 return true; |
| 116 } | 130 } |
| 117 | 131 |
| 118 bool HandleNewTab() { | 132 bool HandleNewTab() { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 case OPEN_FILE_MANAGER_TAB: | 447 case OPEN_FILE_MANAGER_TAB: |
| 434 return HandleFileManager(false /* as_dialog */); | 448 return HandleFileManager(false /* as_dialog */); |
| 435 case OPEN_CROSH: | 449 case OPEN_CROSH: |
| 436 return HandleCrosh(); | 450 return HandleCrosh(); |
| 437 case TOGGLE_SPOKEN_FEEDBACK: | 451 case TOGGLE_SPOKEN_FEEDBACK: |
| 438 return HandleToggleSpokenFeedback(); | 452 return HandleToggleSpokenFeedback(); |
| 439 case TOGGLE_WIFI: | 453 case TOGGLE_WIFI: |
| 440 if (Shell::GetInstance()->tray_delegate()) | 454 if (Shell::GetInstance()->tray_delegate()) |
| 441 Shell::GetInstance()->tray_delegate()->ToggleWifi(); | 455 Shell::GetInstance()->tray_delegate()->ToggleWifi(); |
| 442 return true; | 456 return true; |
| 443 case CYCLE_DISPLAY_MODE: { | 457 case CYCLE_DISPLAY_MODE: |
| 444 Shell* shell = Shell::GetInstance(); | 458 HandleCycleDisplayMode(); |
| 445 if (shell->output_configurator()->connected_output_count() > 1) { | 459 return true; |
| 446 internal::OutputConfiguratorAnimation* animation = | |
| 447 shell->output_configurator_animation(); | |
| 448 animation->StartFadeOutAnimation(base::Bind( | |
| 449 base::IgnoreResult(&chromeos::OutputConfigurator::CycleDisplayMode), | |
| 450 base::Unretained(shell->output_configurator()))); | |
| 451 return true; | |
| 452 } | |
| 453 return false; | |
| 454 } | |
| 455 #endif | 460 #endif |
| 456 case OPEN_FEEDBACK_PAGE: | 461 case OPEN_FEEDBACK_PAGE: |
| 457 ash::Shell::GetInstance()->delegate()->OpenFeedbackPage(); | 462 ash::Shell::GetInstance()->delegate()->OpenFeedbackPage(); |
| 458 return true; | 463 return true; |
| 459 case EXIT: | 464 case EXIT: |
| 460 return HandleExit(); | 465 return HandleExit(); |
| 461 case NEW_INCOGNITO_WINDOW: | 466 case NEW_INCOGNITO_WINDOW: |
| 462 return HandleNewWindow(true /* is_incognito */); | 467 return HandleNewWindow(true /* is_incognito */); |
| 463 case NEW_TAB: | 468 case NEW_TAB: |
| 464 if (key_code == ui::VKEY_T && shell->delegate()) | 469 if (key_code == ui::VKEY_T && shell->delegate()) |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 break; | 672 break; |
| 668 } | 673 } |
| 669 case ROTATE_WINDOWS: | 674 case ROTATE_WINDOWS: |
| 670 return HandleRotateWindows(); | 675 return HandleRotateWindows(); |
| 671 case ROTATE_SCREEN: | 676 case ROTATE_SCREEN: |
| 672 return HandleRotateScreen(); | 677 return HandleRotateScreen(); |
| 673 case TOGGLE_DESKTOP_BACKGROUND_MODE: | 678 case TOGGLE_DESKTOP_BACKGROUND_MODE: |
| 674 return HandleToggleDesktopBackgroundMode(); | 679 return HandleToggleDesktopBackgroundMode(); |
| 675 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: | 680 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
| 676 return HandleToggleRootWindowFullScreen(); | 681 return HandleToggleRootWindowFullScreen(); |
| 677 case DISPLAY_ADD_REMOVE: | |
| 678 internal::MultiDisplayManager::AddRemoveDisplay(); | |
| 679 return true; | |
| 680 case DISPLAY_CYCLE: | |
| 681 internal::MultiDisplayManager::CycleDisplay(); | |
| 682 return true; | |
| 683 case DISPLAY_TOGGLE_SCALE: | 682 case DISPLAY_TOGGLE_SCALE: |
| 684 internal::MultiDisplayManager::ToggleDisplayScale(); | 683 internal::MultiDisplayManager::ToggleDisplayScale(); |
| 685 return true; | 684 return true; |
| 686 case MAGNIFY_SCREEN_ZOOM_IN: | 685 case MAGNIFY_SCREEN_ZOOM_IN: |
| 687 return HandleMagnifyScreen(1); | 686 return HandleMagnifyScreen(1); |
| 688 case MAGNIFY_SCREEN_ZOOM_OUT: | 687 case MAGNIFY_SCREEN_ZOOM_OUT: |
| 689 return HandleMagnifyScreen(-1); | 688 return HandleMagnifyScreen(-1); |
| 690 case MEDIA_NEXT_TRACK: | 689 case MEDIA_NEXT_TRACK: |
| 691 return HandleMediaNextTrack(); | 690 return HandleMediaNextTrack(); |
| 692 case MEDIA_PLAY_PAUSE: | 691 case MEDIA_PLAY_PAUSE: |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 accelerators_.insert( | 786 accelerators_.insert( |
| 788 std::make_pair(accelerator, accelerators[i].action)); | 787 std::make_pair(accelerator, accelerators[i].action)); |
| 789 } | 788 } |
| 790 } | 789 } |
| 791 | 790 |
| 792 bool AcceleratorController::CanHandleAccelerators() const { | 791 bool AcceleratorController::CanHandleAccelerators() const { |
| 793 return true; | 792 return true; |
| 794 } | 793 } |
| 795 | 794 |
| 796 } // namespace ash | 795 } // namespace ash |
| OLD | NEW |