| 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 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "ash/accelerators/accelerator_commands.h" | 12 #include "ash/accelerators/accelerator_commands.h" |
| 13 #include "ash/accelerators/debug_commands.h" | 13 #include "ash/accelerators/debug_commands.h" |
| 14 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 15 #include "ash/debug.h" | 15 #include "ash/debug.h" |
| 16 #include "ash/display/window_tree_host_manager.h" | 16 #include "ash/display/window_tree_host_manager.h" |
| 17 #include "ash/focus_cycler.h" | 17 #include "ash/focus_cycler.h" |
| 18 #include "ash/gpu_support.h" | 18 #include "ash/gpu_support.h" |
| 19 #include "ash/ime_control_delegate.h" | 19 #include "ash/ime_control_delegate.h" |
| 20 #include "ash/magnifier/magnification_controller.h" | 20 #include "ash/magnifier/magnification_controller.h" |
| 21 #include "ash/magnifier/partial_magnification_controller.h" | 21 #include "ash/magnifier/partial_magnification_controller.h" |
| 22 #include "ash/media_delegate.h" | 22 #include "ash/media_delegate.h" |
| 23 #include "ash/multi_profile_uma.h" | 23 #include "ash/multi_profile_uma.h" |
| 24 #include "ash/new_window_delegate.h" | 24 #include "ash/new_window_delegate.h" |
| 25 #include "ash/root_window_controller.h" | 25 #include "ash/root_window_controller.h" |
| 26 #include "ash/rotator/screen_rotation_animator.h" | 26 #include "ash/rotator/screen_rotation_animator.h" |
| 27 #include "ash/rotator/window_rotation.h" | 27 #include "ash/rotator/window_rotation.h" |
| 28 #include "ash/screen_util.h" |
| 28 #include "ash/screenshot_delegate.h" | 29 #include "ash/screenshot_delegate.h" |
| 29 #include "ash/session/session_state_delegate.h" | 30 #include "ash/session/session_state_delegate.h" |
| 30 #include "ash/shelf/shelf.h" | 31 #include "ash/shelf/shelf.h" |
| 31 #include "ash/shelf/shelf_delegate.h" | 32 #include "ash/shelf/shelf_delegate.h" |
| 32 #include "ash/shelf/shelf_model.h" | 33 #include "ash/shelf/shelf_model.h" |
| 33 #include "ash/shelf/shelf_widget.h" | 34 #include "ash/shelf/shelf_widget.h" |
| 34 #include "ash/shell.h" | 35 #include "ash/shell.h" |
| 35 #include "ash/shell_delegate.h" | 36 #include "ash/shell_delegate.h" |
| 36 #include "ash/shell_window_ids.h" | 37 #include "ash/shell_window_ids.h" |
| 37 #include "ash/system/brightness_control_delegate.h" | 38 #include "ash/system/brightness_control_delegate.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 68 #include "ui/compositor/layer_animator.h" | 69 #include "ui/compositor/layer_animator.h" |
| 69 #include "ui/events/event.h" | 70 #include "ui/events/event.h" |
| 70 #include "ui/events/keycodes/keyboard_codes.h" | 71 #include "ui/events/keycodes/keyboard_codes.h" |
| 71 #include "ui/gfx/screen.h" | 72 #include "ui/gfx/screen.h" |
| 72 #include "ui/message_center/message_center.h" | 73 #include "ui/message_center/message_center.h" |
| 73 #include "ui/message_center/notification.h" | 74 #include "ui/message_center/notification.h" |
| 74 #include "ui/message_center/notifier_settings.h" | 75 #include "ui/message_center/notifier_settings.h" |
| 75 #include "ui/views/controls/webview/webview.h" | 76 #include "ui/views/controls/webview/webview.h" |
| 76 | 77 |
| 77 #if defined(OS_CHROMEOS) | 78 #if defined(OS_CHROMEOS) |
| 79 #include "ash/display/display_configuration_controller.h" |
| 78 #include "ash/system/chromeos/keyboard_brightness_controller.h" | 80 #include "ash/system/chromeos/keyboard_brightness_controller.h" |
| 79 #include "base/sys_info.h" | 81 #include "base/sys_info.h" |
| 80 #include "ui/base/ime/chromeos/ime_keyboard.h" | 82 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 81 #include "ui/base/ime/chromeos/input_method_manager.h" | 83 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 82 #endif // defined(OS_CHROMEOS) | 84 #endif // defined(OS_CHROMEOS) |
| 83 | 85 |
| 84 namespace ash { | 86 namespace ash { |
| 85 namespace { | 87 namespace { |
| 86 | 88 |
| 87 using base::UserMetricsAction; | 89 using base::UserMetricsAction; |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 return delegate->IsSpokenFeedbackEnabled(); | 630 return delegate->IsSpokenFeedbackEnabled(); |
| 629 } | 631 } |
| 630 | 632 |
| 631 void HandleSilenceSpokenFeedback() { | 633 void HandleSilenceSpokenFeedback() { |
| 632 base::RecordAction(UserMetricsAction("Accel_Silence_Spoken_Feedback")); | 634 base::RecordAction(UserMetricsAction("Accel_Silence_Spoken_Feedback")); |
| 633 Shell::GetInstance()->accessibility_delegate()->SilenceSpokenFeedback(); | 635 Shell::GetInstance()->accessibility_delegate()->SilenceSpokenFeedback(); |
| 634 } | 636 } |
| 635 | 637 |
| 636 void HandleSwapPrimaryDisplay() { | 638 void HandleSwapPrimaryDisplay() { |
| 637 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); | 639 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); |
| 638 Shell::GetInstance()->window_tree_host_manager()->SwapPrimaryDisplay(); | 640 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( |
| 641 ScreenUtil::GetSecondaryDisplay().id(), true /* user_action */); |
| 639 } | 642 } |
| 640 | 643 |
| 641 bool CanHandleCycleUser() { | 644 bool CanHandleCycleUser() { |
| 642 Shell* shell = Shell::GetInstance(); | 645 Shell* shell = Shell::GetInstance(); |
| 643 return shell->delegate()->IsMultiProfilesEnabled() && | 646 return shell->delegate()->IsMultiProfilesEnabled() && |
| 644 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; | 647 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; |
| 645 } | 648 } |
| 646 | 649 |
| 647 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { | 650 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { |
| 648 MultiProfileUMA::RecordSwitchActiveUser( | 651 MultiProfileUMA::RecordSwitchActiveUser( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 677 void HandleToggleCapsLock() { | 680 void HandleToggleCapsLock() { |
| 678 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); | 681 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); |
| 679 chromeos::input_method::InputMethodManager* ime = | 682 chromeos::input_method::InputMethodManager* ime = |
| 680 chromeos::input_method::InputMethodManager::Get(); | 683 chromeos::input_method::InputMethodManager::Get(); |
| 681 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); | 684 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); |
| 682 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); | 685 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); |
| 683 } | 686 } |
| 684 | 687 |
| 685 void HandleToggleMirrorMode() { | 688 void HandleToggleMirrorMode() { |
| 686 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); | 689 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
| 687 Shell::GetInstance()->window_tree_host_manager()->ToggleMirrorMode(); | 690 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); |
| 691 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( |
| 692 mirror, true /* user_action */); |
| 688 } | 693 } |
| 689 | 694 |
| 690 void HandleToggleSpokenFeedback() { | 695 void HandleToggleSpokenFeedback() { |
| 691 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); | 696 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); |
| 692 | 697 |
| 693 Shell::GetInstance()->accessibility_delegate()-> | 698 Shell::GetInstance()->accessibility_delegate()-> |
| 694 ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_SHOW); | 699 ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_SHOW); |
| 695 } | 700 } |
| 696 | 701 |
| 697 bool CanHandleToggleTouchViewTesting() { | 702 bool CanHandleToggleTouchViewTesting() { |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 } | 1450 } |
| 1446 | 1451 |
| 1447 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1452 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 1448 scoped_ptr<KeyboardBrightnessControlDelegate> | 1453 scoped_ptr<KeyboardBrightnessControlDelegate> |
| 1449 keyboard_brightness_control_delegate) { | 1454 keyboard_brightness_control_delegate) { |
| 1450 keyboard_brightness_control_delegate_ = | 1455 keyboard_brightness_control_delegate_ = |
| 1451 std::move(keyboard_brightness_control_delegate); | 1456 std::move(keyboard_brightness_control_delegate); |
| 1452 } | 1457 } |
| 1453 | 1458 |
| 1454 } // namespace ash | 1459 } // namespace ash |
| OLD | NEW |