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")); |
640 #if defined(OS_CHROMEOS) | |
oshima
2016/01/19 18:49:16
I think you don't have to worry about other platfo
stevenjb
2016/01/19 20:32:04
Currently display_configuration_controller() only
oshima
2016/01/19 20:59:30
ack. hopefully we can remove ifdef soon.
stevenjb
2016/01/20 01:25:36
Actually, I went ahead and fixed this.
| |
641 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | |
642 if (display_manager->GetNumDisplays() < 2) | |
643 return; | |
644 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( | |
645 ScreenUtil::GetSecondaryDisplay().id(), true /* user_action */); | |
646 #else | |
647 // On non Chrome OS platforms this will swap the display immediately with | |
648 // no animation or frequencey limiter. | |
638 Shell::GetInstance()->window_tree_host_manager()->SwapPrimaryDisplay(); | 649 Shell::GetInstance()->window_tree_host_manager()->SwapPrimaryDisplay(); |
650 #endif | |
639 } | 651 } |
640 | 652 |
641 bool CanHandleCycleUser() { | 653 bool CanHandleCycleUser() { |
642 Shell* shell = Shell::GetInstance(); | 654 Shell* shell = Shell::GetInstance(); |
643 return shell->delegate()->IsMultiProfilesEnabled() && | 655 return shell->delegate()->IsMultiProfilesEnabled() && |
644 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; | 656 shell->session_state_delegate()->NumberOfLoggedInUsers() > 1; |
645 } | 657 } |
646 | 658 |
647 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { | 659 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { |
648 MultiProfileUMA::RecordSwitchActiveUser( | 660 MultiProfileUMA::RecordSwitchActiveUser( |
(...skipping 28 matching lines...) Expand all Loading... | |
677 void HandleToggleCapsLock() { | 689 void HandleToggleCapsLock() { |
678 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); | 690 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); |
679 chromeos::input_method::InputMethodManager* ime = | 691 chromeos::input_method::InputMethodManager* ime = |
680 chromeos::input_method::InputMethodManager::Get(); | 692 chromeos::input_method::InputMethodManager::Get(); |
681 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); | 693 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); |
682 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); | 694 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); |
683 } | 695 } |
684 | 696 |
685 void HandleToggleMirrorMode() { | 697 void HandleToggleMirrorMode() { |
686 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); | 698 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
699 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); | |
700 #if defined(OS_CHROMEOS) | |
701 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( | |
702 mirror, true /* user_action */); | |
703 #else | |
704 // On non Chrome OS platforms this toggle mirror mode immediately with | |
705 // no animation or frequencey limiter. | |
687 Shell::GetInstance()->window_tree_host_manager()->ToggleMirrorMode(); | 706 Shell::GetInstance()->window_tree_host_manager()->ToggleMirrorMode(); |
707 #endif | |
688 } | 708 } |
689 | 709 |
690 void HandleToggleSpokenFeedback() { | 710 void HandleToggleSpokenFeedback() { |
691 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); | 711 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); |
692 | 712 |
693 Shell::GetInstance()->accessibility_delegate()-> | 713 Shell::GetInstance()->accessibility_delegate()-> |
694 ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_SHOW); | 714 ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_SHOW); |
695 } | 715 } |
696 | 716 |
697 bool CanHandleToggleTouchViewTesting() { | 717 bool CanHandleToggleTouchViewTesting() { |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1453 } | 1473 } |
1454 | 1474 |
1455 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1475 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
1456 scoped_ptr<KeyboardBrightnessControlDelegate> | 1476 scoped_ptr<KeyboardBrightnessControlDelegate> |
1457 keyboard_brightness_control_delegate) { | 1477 keyboard_brightness_control_delegate) { |
1458 keyboard_brightness_control_delegate_ = | 1478 keyboard_brightness_control_delegate_ = |
1459 std::move(keyboard_brightness_control_delegate); | 1479 std::move(keyboard_brightness_control_delegate); |
1460 } | 1480 } |
1461 | 1481 |
1462 } // namespace ash | 1482 } // namespace ash |
OLD | NEW |