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

Unified Diff: ash/mus/accelerators/accelerator_controller_delegate_mus.cc

Issue 2415163002: Expand and split DisplayController mojom. (Closed)
Patch Set: Actually fix case statements. Created 4 years, 2 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 | services/ui/display/platform_screen_ozone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/accelerators/accelerator_controller_delegate_mus.cc
diff --git a/ash/mus/accelerators/accelerator_controller_delegate_mus.cc b/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
index 47588024539b3c25075adf709a7c4b22825ffbb7..39a7f232081c991b5dac2ae482a10f303c504e48 100644
--- a/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
+++ b/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "mash/public/interfaces/launchable.mojom.h"
#include "services/ui/public/interfaces/display/display_controller.mojom.h"
+#include "services/ui/public/interfaces/display/test_display_controller.mojom.h"
namespace ash {
namespace mus {
@@ -51,30 +52,20 @@ bool AcceleratorControllerDelegateMus::HandlesAction(AcceleratorAction action) {
return false;
#if defined(OS_CHROMEOS)
- case DEV_ADD_REMOVE_DISPLAY: {
- display::mojom::DisplayControllerPtr display_controller;
- connector_->ConnectToInterface("service:ui", &display_controller);
- display_controller->ToggleVirtualDisplay();
+ case DEV_ADD_REMOVE_DISPLAY:
+ case SWAP_PRIMARY_DISPLAY:
+ case TOUCH_HUD_PROJECTION_TOGGLE:
return true;
- }
case DEV_TOGGLE_UNIFIED_DESKTOP:
case LOCK_PRESSED:
case LOCK_RELEASED:
case POWER_PRESSED:
case POWER_RELEASED:
- case SWAP_PRIMARY_DISPLAY:
case TOGGLE_MIRROR_MODE:
case TOUCH_HUD_CLEAR:
case TOUCH_HUD_MODE_CHANGE:
NOTIMPLEMENTED();
return false;
- case TOUCH_HUD_PROJECTION_TOGGLE: {
- mash::mojom::LaunchablePtr launchable;
- connector_->ConnectToInterface("service:touch_hud", &launchable);
- launchable->Launch(mash::mojom::kWindow,
- mash::mojom::LaunchMode::DEFAULT);
- return true;
- }
#endif
default:
@@ -87,14 +78,49 @@ bool AcceleratorControllerDelegateMus::CanPerformAction(
AcceleratorAction action,
const ui::Accelerator& accelerator,
const ui::Accelerator& previous_accelerator) {
+#if defined(OS_CHROMEOS)
+ switch (action) {
+ case DEV_ADD_REMOVE_DISPLAY:
+ case SWAP_PRIMARY_DISPLAY:
+ case TOUCH_HUD_PROJECTION_TOGGLE:
+ return true;
+ default:
+ break;
+ }
+#endif
return false;
}
void AcceleratorControllerDelegateMus::PerformAction(
AcceleratorAction action,
const ui::Accelerator& accelerator) {
- // Should never be hit as HandlesAction() unconditionally returns false.
+#if defined(OS_CHROMEOS)
+ switch (action) {
+ case DEV_ADD_REMOVE_DISPLAY: {
+ display::mojom::TestDisplayControllerPtr test_display_controller;
+ connector_->ConnectToInterface("service:ui", &test_display_controller);
+ test_display_controller->ToggleAddRemoveDisplay();
+ break;
+ }
+ case SWAP_PRIMARY_DISPLAY: {
+ display::mojom::DisplayControllerPtr display_controller;
+ connector_->ConnectToInterface("service:ui", &display_controller);
+ display_controller->SwapPrimaryDisplay();
+ break;
+ }
+ case TOUCH_HUD_PROJECTION_TOGGLE: {
+ mash::mojom::LaunchablePtr launchable;
+ connector_->ConnectToInterface("service:touch_hud", &launchable);
+ launchable->Launch(mash::mojom::kWindow,
+ mash::mojom::LaunchMode::DEFAULT);
+ break;
+ }
+ default:
+ NOTREACHED();
+ }
+#else
NOTREACHED();
+#endif
}
void AcceleratorControllerDelegateMus::ShowDeprecatedAcceleratorNotification(
« no previous file with comments | « no previous file | services/ui/display/platform_screen_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698