Chromium Code Reviews| Index: ash/common/accelerators/accelerator_controller.cc |
| diff --git a/ash/common/accelerators/accelerator_controller.cc b/ash/common/accelerators/accelerator_controller.cc |
| index 3205199b9bb1220f404e9edd7f117d09728b4568..e817cb0f67bfb34636d91bed2061563b63fd4a68 100644 |
| --- a/ash/common/accelerators/accelerator_controller.cc |
| +++ b/ash/common/accelerators/accelerator_controller.cc |
| @@ -15,9 +15,11 @@ |
| #include "ash/common/multi_profile_uma.h" |
| #include "ash/common/new_window_delegate.h" |
| #include "ash/common/session/session_state_delegate.h" |
| +#include "ash/common/shelf/wm_shelf.h" |
| #include "ash/common/shell_delegate.h" |
| #include "ash/common/system/brightness_control_delegate.h" |
| #include "ash/common/system/keyboard_brightness_control_delegate.h" |
| +#include "ash/common/system/status_area_widget.h" |
| #include "ash/common/system/tray/system_tray_delegate.h" |
| #include "ash/common/system/tray/system_tray_notifier.h" |
| #include "ash/common/system/volume_control_delegate.h" |
| @@ -27,6 +29,7 @@ |
| #include "ash/common/wm/window_positioning_utils.h" |
| #include "ash/common/wm/window_state.h" |
| #include "ash/common/wm/wm_event.h" |
| +#include "ash/common/wm_root_window_controller.h" |
| #include "ash/common/wm_shell.h" |
| #include "ash/common/wm_window.h" |
| #include "base/metrics/histogram_macros.h" |
| @@ -36,6 +39,9 @@ |
| #include "ui/keyboard/keyboard_controller.h" |
| #if defined(OS_CHROMEOS) |
| +#include "ash/common/palette_delegate.h" |
| +#include "ash/common/system/chromeos/palette/palette_tray.h" |
| +#include "ash/common/system/chromeos/palette/palette_utils.h" |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/dbus/power_manager_client.h" |
| #include "ui/base/ime/chromeos/ime_keyboard.h" |
| @@ -337,6 +343,21 @@ void HandleLock() { |
| WmShell::Get()->GetSessionStateDelegate()->LockScreen(); |
| } |
| +void HandleShowStylusTools() { |
| + base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); |
| + |
| + WmRootWindowController* root_window_controller = |
| + WmShell::Get()->GetRootWindowForNewWindows()->GetRootWindowController(); |
| + PaletteTray* palette_tray = |
| + root_window_controller->GetShelf()->GetStatusAreaWidget()->palette_tray(); |
| + palette_tray->OpenBubble(); |
| +} |
| + |
| +bool CanHandleShowStylusTools() { |
| + return IsPaletteFeatureEnabled() && |
|
stevenjb
2016/08/26 20:54:31
Can we just test whether palette_delegate() is nul
jdufault
2016/08/26 21:33:13
Ah, good catch. I've made it so that the palette d
|
| + WmShell::Get()->palette_delegate()->ShouldShowPalette(); |
| +} |
| + |
| void HandleSuspend() { |
| base::RecordAction(UserMetricsAction("Accel_Suspend")); |
| chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); |
| @@ -689,6 +710,8 @@ bool AcceleratorController::CanPerformAction( |
| return CanHandleDisableCapsLock(previous_accelerator); |
| case LOCK_SCREEN: |
| return CanHandleLock(); |
| + case SHOW_STYLUS_TOOLS: |
| + return CanHandleShowStylusTools(); |
| case SWITCH_TO_PREVIOUS_USER: |
| case SWITCH_TO_NEXT_USER: |
| return CanHandleCycleUser(); |
| @@ -886,6 +909,9 @@ void AcceleratorController::PerformAction(AcceleratorAction action, |
| case OPEN_GET_HELP: |
| HandleGetHelp(); |
| break; |
| + case SHOW_STYLUS_TOOLS: |
| + HandleShowStylusTools(); |
| + break; |
| case SUSPEND: |
| HandleSuspend(); |
| break; |