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

Unified Diff: ash/common/media_controller.cc

Issue 2563643003: mash: Change the MediaDelegate to a Media{Controller,Client}. (Closed)
Patch Set: Comment fixes 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/media_controller.h ('k') | ash/common/media_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/media_controller.cc
diff --git a/ash/common/media_controller.cc b/ash/common/media_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7a72fe4b0fc82a37e0deb1b371c057de099c3214
--- /dev/null
+++ b/ash/common/media_controller.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/common/media_controller.h"
+
+namespace ash {
+
+MediaController::MediaController() {}
+
+MediaController::~MediaController() {}
+
+void MediaController::BindRequest(mojom::MediaControllerRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+}
+
+void MediaController::AddObserver(MediaCaptureObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void MediaController::RemoveObserver(MediaCaptureObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+void MediaController::HandleMediaNextTrack() {
+ if (client_)
+ client_->HandleMediaNextTrack();
+}
+
+void MediaController::HandleMediaPlayPause() {
+ if (client_)
+ client_->HandleMediaPlayPause();
+}
+
+void MediaController::HandleMediaPrevTrack() {
+ if (client_)
+ client_->HandleMediaPrevTrack();
+}
+
+void MediaController::RequestCaptureState() {
+ if (client_)
+ client_->RequestCaptureState();
+}
+
+void MediaController::SetClient(mojom::MediaClientAssociatedPtrInfo client) {
+ client_.Bind(std::move(client));
+}
+
+void MediaController::NotifyCaptureState(
+ const std::vector<mojom::MediaCaptureState>& capture_states) {
+ for (auto& observer : observers_)
+ observer.OnMediaCaptureChanged(capture_states);
+}
+
+} // namespace ash
« no previous file with comments | « ash/common/media_controller.h ('k') | ash/common/media_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698