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 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
641 if (display_manager->GetNumDisplays() < 2) | |
642 return; | |
643 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( | |
644 ScreenUtil::GetSecondaryDisplay().id(), true /* user_action */); | |
639 } | 645 } |
640 | 646 |
641 bool CanHandleCycleUser() { | 647 bool CanHandleCycleUser() { |
642 Shell* shell = Shell::GetInstance(); | 648 Shell* shell = Shell::GetInstance(); |
643 return shell->delegate()->IsMultiProfilesEnabled() && | 649 return shell->delegate()->IsMultiProfilesEnabled() && |
644 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; | 650 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; |
645 } | 651 } |
646 | 652 |
647 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { | 653 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { |
648 MultiProfileUMA::RecordSwitchActiveUser( | 654 MultiProfileUMA::RecordSwitchActiveUser( |
(...skipping 28 matching lines...) Expand all Loading... | |
677 void HandleToggleCapsLock() { | 683 void HandleToggleCapsLock() { |
678 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); | 684 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); |
679 chromeos::input_method::InputMethodManager* ime = | 685 chromeos::input_method::InputMethodManager* ime = |
680 chromeos::input_method::InputMethodManager::Get(); | 686 chromeos::input_method::InputMethodManager::Get(); |
681 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); | 687 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); |
682 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); | 688 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); |
683 } | 689 } |
684 | 690 |
685 void HandleToggleMirrorMode() { | 691 void HandleToggleMirrorMode() { |
686 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); | 692 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
693 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); | |
694 #if defined(OS_CHROMEOS) | |
oshima
2016/01/20 02:02:51
we can now remove this ifdef?
stevenjb
2016/01/20 02:13:12
Yeah, I cleaned that up in PS 6.
| |
695 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( | |
696 mirror, true /* user_action */); | |
697 #else | |
698 // On non Chrome OS platforms this toggle mirror mode immediately with | |
699 // no animation or frequencey limiter. | |
687 Shell::GetInstance()->window_tree_host_manager()->ToggleMirrorMode(); | 700 Shell::GetInstance()->window_tree_host_manager()->ToggleMirrorMode(); |
701 #endif | |
688 } | 702 } |
689 | 703 |
690 void HandleToggleSpokenFeedback() { | 704 void HandleToggleSpokenFeedback() { |
691 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); | 705 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); |
692 | 706 |
693 Shell::GetInstance()->accessibility_delegate()-> | 707 Shell::GetInstance()->accessibility_delegate()-> |
694 ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_SHOW); | 708 ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_SHOW); |
695 } | 709 } |
696 | 710 |
697 bool CanHandleToggleTouchViewTesting() { | 711 bool CanHandleToggleTouchViewTesting() { |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1453 } | 1467 } |
1454 | 1468 |
1455 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1469 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
1456 scoped_ptr<KeyboardBrightnessControlDelegate> | 1470 scoped_ptr<KeyboardBrightnessControlDelegate> |
1457 keyboard_brightness_control_delegate) { | 1471 keyboard_brightness_control_delegate) { |
1458 keyboard_brightness_control_delegate_ = | 1472 keyboard_brightness_control_delegate_ = |
1459 std::move(keyboard_brightness_control_delegate); | 1473 std::move(keyboard_brightness_control_delegate); |
1460 } | 1474 } |
1461 | 1475 |
1462 } // namespace ash | 1476 } // namespace ash |
OLD | NEW |