forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia_controller.cc
60 lines (45 loc) · 1.47 KB
/
media_controller.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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/media_controller.h"
namespace ash {
MediaController::MediaController() = default;
MediaController::~MediaController() = default;
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::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);
}
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::SuspendMediaSessions() {
if (client_)
client_->SuspendMediaSessions();
}
} // namespace ash