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

Unified Diff: ash/accelerators/accelerator_controller_delegate_aura.cc

Issue 2276233002: ash/chromeos: Add shift-alt-p shortcut to open palette. (Closed)
Patch Set: Initial upload Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/common/accelerators/accelerator_table.h » ('j') | tools/metrics/actions/actions.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller_delegate_aura.cc
diff --git a/ash/accelerators/accelerator_controller_delegate_aura.cc b/ash/accelerators/accelerator_controller_delegate_aura.cc
index 520cad357c76507681515856031965afd39b5941..1e211befdafc6cdf73c8e0efa60828f37baeeb2c 100644
--- a/ash/accelerators/accelerator_controller_delegate_aura.cc
+++ b/ash/accelerators/accelerator_controller_delegate_aura.cc
@@ -68,6 +68,9 @@
#include "ui/message_center/notifier_settings.h"
#if defined(OS_CHROMEOS)
+#include "ash/common/palette_delegate.h"
James Cook 2016/08/26 01:05:51 Since this code is in ash/common you should be abl
jdufault 2016/08/26 02:44:56 Done.
+#include "ash/common/system/chromeos/palette/palette_tray.h"
+#include "ash/common/system/chromeos/palette/palette_utils.h"
#include "ash/display/display_configuration_controller.h"
#include "base/sys_info.h"
#endif // defined(OS_CHROMEOS)
@@ -321,6 +324,27 @@ bool CanHandleUnpin() {
}
#if defined(OS_CHROMEOS)
+bool CanHandleShowStylusTools() {
+ RootWindowController* controller =
+ RootWindowController::ForTargetRootWindow();
+ StatusAreaWidget* status_area_widget =
+ controller->shelf_widget()->status_area_widget();
+ return status_area_widget && ash::IsPaletteFeatureEnabled() &&
James Cook 2016/08/26 01:05:51 nit: StatusAreaWidget is created in the SHelfWidge
jdufault 2016/08/26 02:44:56 Done.
+ WmShell::Get()->palette_delegate()->ShouldShowPalette();
+}
+
+void HandleShowStylusTools() {
+ base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
+ RootWindowController* controller =
+ RootWindowController::ForTargetRootWindow();
+ StatusAreaWidget* status_area_widget =
+ controller->shelf_widget()->status_area_widget();
+ if (status_area_widget) {
James Cook 2016/08/26 01:05:51 ditto
jdufault 2016/08/26 02:44:56 Done.
+ PaletteTray* palette_tray = status_area_widget->palette_tray();
+ palette_tray->OpenBubble();
+ }
+}
+
void HandleSwapPrimaryDisplay() {
base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display"));
Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId(
@@ -403,6 +427,7 @@ bool AcceleratorControllerDelegateAura::HandlesAction(
case LOCK_RELEASED:
case POWER_PRESSED:
case POWER_RELEASED:
+ case SHOW_STYLUS_TOOLS:
case SWAP_PRIMARY_DISPLAY:
case TOGGLE_MIRROR_MODE:
case TOUCH_HUD_CLEAR:
@@ -465,6 +490,8 @@ bool AcceleratorControllerDelegateAura::CanPerformAction(
case DEBUG_TOGGLE_UNIFIED_DESKTOP:
return debug::DebugAcceleratorsEnabled();
+ case SHOW_STYLUS_TOOLS:
+ return CanHandleShowStylusTools();
case SWAP_PRIMARY_DISPLAY:
return display::Screen::GetScreen()->GetNumDisplays() > 1;
case TOUCH_HUD_CLEAR:
@@ -609,6 +636,9 @@ void AcceleratorControllerDelegateAura::PerformAction(
// D-BUS), but we consume them to prevent them from getting
// passed to apps -- see http://crbug.com/146609.
break;
+ case SHOW_STYLUS_TOOLS:
+ HandleShowStylusTools();
+ break;
case SWAP_PRIMARY_DISPLAY:
HandleSwapPrimaryDisplay();
break;
« no previous file with comments | « no previous file | ash/common/accelerators/accelerator_table.h » ('j') | tools/metrics/actions/actions.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698