Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: ash/common/accelerators/accelerator_controller.cc

Issue 2276233002: ash/chromeos: Add shift-alt-p shortcut to open palette. (Closed)
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/common/accelerators/accelerator_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/common/accelerators/accelerator_commands.h" 7 #include "ash/common/accelerators/accelerator_commands.h"
8 #include "ash/common/accelerators/accelerator_controller_delegate.h" 8 #include "ash/common/accelerators/accelerator_controller_delegate.h"
9 #include "ash/common/accelerators/debug_commands.h" 9 #include "ash/common/accelerators/debug_commands.h"
10 #include "ash/common/accessibility_delegate.h" 10 #include "ash/common/accessibility_delegate.h"
11 #include "ash/common/accessibility_types.h" 11 #include "ash/common/accessibility_types.h"
12 #include "ash/common/focus_cycler.h" 12 #include "ash/common/focus_cycler.h"
13 #include "ash/common/ime_control_delegate.h" 13 #include "ash/common/ime_control_delegate.h"
14 #include "ash/common/media_delegate.h" 14 #include "ash/common/media_delegate.h"
15 #include "ash/common/multi_profile_uma.h" 15 #include "ash/common/multi_profile_uma.h"
16 #include "ash/common/new_window_delegate.h" 16 #include "ash/common/new_window_delegate.h"
17 #include "ash/common/session/session_state_delegate.h" 17 #include "ash/common/session/session_state_delegate.h"
18 #include "ash/common/shelf/wm_shelf.h"
18 #include "ash/common/shell_delegate.h" 19 #include "ash/common/shell_delegate.h"
19 #include "ash/common/system/brightness_control_delegate.h" 20 #include "ash/common/system/brightness_control_delegate.h"
20 #include "ash/common/system/keyboard_brightness_control_delegate.h" 21 #include "ash/common/system/keyboard_brightness_control_delegate.h"
22 #include "ash/common/system/status_area_widget.h"
21 #include "ash/common/system/tray/system_tray_delegate.h" 23 #include "ash/common/system/tray/system_tray_delegate.h"
22 #include "ash/common/system/tray/system_tray_notifier.h" 24 #include "ash/common/system/tray/system_tray_notifier.h"
23 #include "ash/common/system/volume_control_delegate.h" 25 #include "ash/common/system/volume_control_delegate.h"
24 #include "ash/common/wm/mru_window_tracker.h" 26 #include "ash/common/wm/mru_window_tracker.h"
25 #include "ash/common/wm/overview/window_selector_controller.h" 27 #include "ash/common/wm/overview/window_selector_controller.h"
26 #include "ash/common/wm/window_cycle_controller.h" 28 #include "ash/common/wm/window_cycle_controller.h"
27 #include "ash/common/wm/window_positioning_utils.h" 29 #include "ash/common/wm/window_positioning_utils.h"
28 #include "ash/common/wm/window_state.h" 30 #include "ash/common/wm/window_state.h"
29 #include "ash/common/wm/wm_event.h" 31 #include "ash/common/wm/wm_event.h"
32 #include "ash/common/wm_root_window_controller.h"
30 #include "ash/common/wm_shell.h" 33 #include "ash/common/wm_shell.h"
31 #include "ash/common/wm_window.h" 34 #include "ash/common/wm_window.h"
32 #include "base/metrics/histogram_macros.h" 35 #include "base/metrics/histogram_macros.h"
33 #include "base/metrics/user_metrics.h" 36 #include "base/metrics/user_metrics.h"
34 #include "ui/base/accelerators/accelerator.h" 37 #include "ui/base/accelerators/accelerator.h"
35 #include "ui/base/accelerators/accelerator_manager.h" 38 #include "ui/base/accelerators/accelerator_manager.h"
36 #include "ui/keyboard/keyboard_controller.h" 39 #include "ui/keyboard/keyboard_controller.h"
37 40
38 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 #include "ash/common/palette_delegate.h"
43 #include "ash/common/system/chromeos/palette/palette_tray.h"
44 #include "ash/common/system/chromeos/palette/palette_utils.h"
39 #include "chromeos/dbus/dbus_thread_manager.h" 45 #include "chromeos/dbus/dbus_thread_manager.h"
40 #include "chromeos/dbus/power_manager_client.h" 46 #include "chromeos/dbus/power_manager_client.h"
41 #include "ui/base/ime/chromeos/ime_keyboard.h" 47 #include "ui/base/ime/chromeos/ime_keyboard.h"
42 #include "ui/base/ime/chromeos/input_method_manager.h" 48 #include "ui/base/ime/chromeos/input_method_manager.h"
43 #endif // defined(OS_CHROMEOS) 49 #endif // defined(OS_CHROMEOS)
44 50
45 namespace ash { 51 namespace ash {
46 namespace { 52 namespace {
47 53
48 using base::UserMetricsAction; 54 using base::UserMetricsAction;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 336
331 bool CanHandleLock() { 337 bool CanHandleLock() {
332 return WmShell::Get()->GetSessionStateDelegate()->CanLockScreen(); 338 return WmShell::Get()->GetSessionStateDelegate()->CanLockScreen();
333 } 339 }
334 340
335 void HandleLock() { 341 void HandleLock() {
336 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); 342 base::RecordAction(UserMetricsAction("Accel_LockScreen_L"));
337 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); 343 WmShell::Get()->GetSessionStateDelegate()->LockScreen();
338 } 344 }
339 345
346 void HandleShowStylusTools() {
347 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
348
349 WmRootWindowController* root_window_controller =
350 WmShell::Get()->GetRootWindowForNewWindows()->GetRootWindowController();
351 PaletteTray* palette_tray =
352 root_window_controller->GetShelf()->GetStatusAreaWidget()->palette_tray();
353 palette_tray->ShowPalette();
354 }
355
356 bool CanHandleShowStylusTools() {
357 return WmShell::Get()->palette_delegate() &&
358 WmShell::Get()->palette_delegate()->ShouldShowPalette();
359 }
360
340 void HandleSuspend() { 361 void HandleSuspend() {
341 base::RecordAction(UserMetricsAction("Accel_Suspend")); 362 base::RecordAction(UserMetricsAction("Accel_Suspend"));
342 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); 363 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend();
343 } 364 }
344 365
345 bool CanHandleCycleUser() { 366 bool CanHandleCycleUser() {
346 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && 367 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() &&
347 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1; 368 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1;
348 } 369 }
349 370
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 #if defined(OS_CHROMEOS) 703 #if defined(OS_CHROMEOS)
683 case DEBUG_SHOW_TOAST: 704 case DEBUG_SHOW_TOAST:
684 case DEBUG_TOGGLE_TOUCH_PAD: 705 case DEBUG_TOGGLE_TOUCH_PAD:
685 case DEBUG_TOGGLE_TOUCH_SCREEN: 706 case DEBUG_TOGGLE_TOUCH_SCREEN:
686 case DEBUG_TOGGLE_TOUCH_VIEW: 707 case DEBUG_TOGGLE_TOUCH_VIEW:
687 return debug::DebugAcceleratorsEnabled(); 708 return debug::DebugAcceleratorsEnabled();
688 case DISABLE_CAPS_LOCK: 709 case DISABLE_CAPS_LOCK:
689 return CanHandleDisableCapsLock(previous_accelerator); 710 return CanHandleDisableCapsLock(previous_accelerator);
690 case LOCK_SCREEN: 711 case LOCK_SCREEN:
691 return CanHandleLock(); 712 return CanHandleLock();
713 case SHOW_STYLUS_TOOLS:
714 return CanHandleShowStylusTools();
692 case SWITCH_TO_PREVIOUS_USER: 715 case SWITCH_TO_PREVIOUS_USER:
693 case SWITCH_TO_NEXT_USER: 716 case SWITCH_TO_NEXT_USER:
694 return CanHandleCycleUser(); 717 return CanHandleCycleUser();
695 case TOGGLE_CAPS_LOCK: 718 case TOGGLE_CAPS_LOCK:
696 return CanHandleToggleCapsLock(accelerator, previous_accelerator); 719 return CanHandleToggleCapsLock(accelerator, previous_accelerator);
697 #endif 720 #endif
698 case EXIT: 721 case EXIT:
699 case FOCUS_NEXT_PANE: 722 case FOCUS_NEXT_PANE:
700 case FOCUS_PREVIOUS_PANE: 723 case FOCUS_PREVIOUS_PANE:
701 case MEDIA_NEXT_TRACK: 724 case MEDIA_NEXT_TRACK:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 break; 902 break;
880 case OPEN_CROSH: 903 case OPEN_CROSH:
881 HandleCrosh(); 904 HandleCrosh();
882 break; 905 break;
883 case OPEN_FILE_MANAGER: 906 case OPEN_FILE_MANAGER:
884 HandleFileManager(); 907 HandleFileManager();
885 break; 908 break;
886 case OPEN_GET_HELP: 909 case OPEN_GET_HELP:
887 HandleGetHelp(); 910 HandleGetHelp();
888 break; 911 break;
912 case SHOW_STYLUS_TOOLS:
913 HandleShowStylusTools();
914 break;
889 case SUSPEND: 915 case SUSPEND:
890 HandleSuspend(); 916 HandleSuspend();
891 break; 917 break;
892 case SWITCH_TO_NEXT_USER: 918 case SWITCH_TO_NEXT_USER:
893 HandleCycleUser(SessionStateDelegate::CYCLE_TO_NEXT_USER); 919 HandleCycleUser(SessionStateDelegate::CYCLE_TO_NEXT_USER);
894 break; 920 break;
895 case SWITCH_TO_PREVIOUS_USER: 921 case SWITCH_TO_PREVIOUS_USER:
896 HandleCycleUser(SessionStateDelegate::CYCLE_TO_PREVIOUS_USER); 922 HandleCycleUser(SessionStateDelegate::CYCLE_TO_PREVIOUS_USER);
897 break; 923 break;
898 case TOGGLE_CAPS_LOCK: 924 case TOGGLE_CAPS_LOCK:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 994 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
969 actions_needing_window_.find(action) != actions_needing_window_.end()) { 995 actions_needing_window_.find(action) != actions_needing_window_.end()) {
970 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 996 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
971 A11Y_ALERT_WINDOW_NEEDED); 997 A11Y_ALERT_WINDOW_NEEDED);
972 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 998 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
973 } 999 }
974 return RESTRICTION_NONE; 1000 return RESTRICTION_NONE;
975 } 1001 }
976 1002
977 } // namespace ash 1003 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698