OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | |
7 | |
8 #include <memory> | |
imcheng
2017/02/07 19:25:31
#include <vector>
zhaobin
2017/02/07 22:58:45
Done.
| |
9 | |
10 #include "base/callback.h" | |
11 #include "chrome/browser/media/router/media_sink.h" | |
12 | |
13 namespace media_router { | |
14 | |
15 class MediaSinksObserver; | |
16 | |
17 // A service which can be used to start device discovery and resolution in the | |
18 // background to generate MediaSinks. In addition, the service is capable of | |
19 // answering MediaSink queries using the sinks that it generated. This class is | |
imcheng
2017/02/07 19:25:31
nit: start the sentence about thread safety in a n
zhaobin
2017/02/07 22:58:45
Done.
| |
20 // not thread safe. All methods must be called from the UI thread. | |
21 class MediaSinkService { | |
22 public: | |
23 // Callback used for |Start()|. | |
24 // Arg 0: Sinks discovered and resolved by the service. | |
25 using OnSinksDiscoveredCallback = | |
26 base::Callback<void(const std::vector<MediaSink>&)>; | |
imcheng
2017/02/07 19:25:31
Since we are defining subtypes of MediaSink in ano
zhaobin
2017/02/07 22:58:45
Done.
| |
27 | |
28 virtual ~MediaSinkService() = default; | |
29 | |
30 // Starts sink discovery. No-ops if already started. | |
31 // Sinks discovered and resolved are continuously passed to | |
32 // |callback|. | |
33 virtual void Start(const OnSinksDiscoveredCallback& callback) = 0; | |
34 | |
35 // Adds a sink query to observe for MediaSink updates. | |
36 // Only one observer can be added for a given MediaSource. | |
37 // Start() must be called first. This class does not take | |
38 // ownership of |observer|. | |
39 virtual void AddSinkQuery(MediaSinksObserver* observer) = 0; | |
40 | |
41 // Removes a sink query and stop observing for MediaSink updates. | |
42 virtual void RemoveSinkQuery(MediaSinksObserver* observer) = 0; | |
43 }; | |
44 | |
45 } // namespace media_router | |
46 | |
47 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | |
OLD | NEW |