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

Unified Diff: ash/common/accelerators/accelerator_controller.cc

Issue 2552483002: mash: Have chrome set itself as a controller interface for changing volume (Closed)
Patch Set: comment Created 4 years 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 | « ash/common/accelerators/accelerator_controller.h ('k') | ash/common/mojo_interface_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/accelerators/accelerator_controller.cc
diff --git a/ash/common/accelerators/accelerator_controller.cc b/ash/common/accelerators/accelerator_controller.cc
index 3a19e4feb0f4a2c1642444f0886686c708863d1b..6edb692016723679f07d90d2c209e703575a21ae 100644
--- a/ash/common/accelerators/accelerator_controller.cc
+++ b/ash/common/accelerators/accelerator_controller.cc
@@ -4,6 +4,8 @@
#include "ash/common/accelerators/accelerator_controller.h"
+#include <utility>
+
#include "ash/common/accelerators/accelerator_commands.h"
#include "ash/common/accelerators/accelerator_controller_delegate.h"
#include "ash/common/accelerators/debug_commands.h"
@@ -35,8 +37,6 @@
#include "ash/public/interfaces/new_window.mojom.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
-#include "content/public/common/service_names.mojom.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/accelerator_manager.h"
#include "ui/keyboard/keyboard_controller.h"
@@ -684,6 +684,16 @@ bool AcceleratorController::CanHandleAccelerators() const {
return true;
}
+void AcceleratorController::BindRequest(
+ mojom::AcceleratorControllerRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+}
+
+void AcceleratorController::SetVolumeController(
+ mojom::VolumeControllerPtr controller) {
+ volume_controller_ = std::move(controller);
+}
+
///////////////////////////////////////////////////////////////////////////////
// AcceleratorController, private:
@@ -1095,13 +1105,13 @@ void AcceleratorController::PerformAction(AcceleratorAction action,
WmShell::Get()->system_tray_notifier()->NotifyRequestToggleWifi();
break;
case VOLUME_DOWN:
- HandleVolumeDown(GetVolumeController(), accelerator);
+ HandleVolumeDown(volume_controller_.get(), accelerator);
break;
case VOLUME_MUTE:
- HandleVolumeMute(GetVolumeController(), accelerator);
+ HandleVolumeMute(volume_controller_.get(), accelerator);
break;
case VOLUME_UP:
- HandleVolumeUp(GetVolumeController(), accelerator);
+ HandleVolumeUp(volume_controller_.get(), accelerator);
break;
#else
case DUMMY_FOR_RESERVED:
@@ -1164,19 +1174,4 @@ AcceleratorController::GetAcceleratorProcessingRestriction(int action) {
return RESTRICTION_NONE;
}
-mojom::VolumeController* AcceleratorController::GetVolumeController() {
- if (!volume_controller_ && WmShell::Get()->delegate()->GetShellConnector()) {
- WmShell::Get()->delegate()->GetShellConnector()->ConnectToInterface(
- content::mojom::kBrowserServiceName, &volume_controller_);
- volume_controller_.set_connection_error_handler(
- base::Bind(&AcceleratorController::OnVolumeControllerConnectionError,
- base::Unretained(this)));
- }
- return volume_controller_.get();
-}
-
-void AcceleratorController::OnVolumeControllerConnectionError() {
- volume_controller_.reset();
-}
-
} // namespace ash
« no previous file with comments | « ash/common/accelerators/accelerator_controller.h ('k') | ash/common/mojo_interface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698