Chromium Code Reviews| 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> | |
| 9 | |
| 10 #include "base/callback_list.h" | |
|
imcheng
2017/02/07 00:48:14
Did you mean to include base/callback.h ?
zhaobin
2017/02/07 02:38:50
Done.
| |
| 11 #include "chrome/browser/media/router/media_sink.h" | |
| 12 | |
| 13 namespace media_router { | |
| 14 | |
| 15 class MediaSinksObserver; | |
| 16 | |
| 17 // MediaSinkService defines an interface which can be implemented by DIAL, Cast | |
|
imcheng
2017/02/07 00:48:13
Comment suggestion:
A service which can be used t
zhaobin
2017/02/07 02:38:50
Done.
| |
| 18 // or future protocols to produce MediaSinks from device discovery/resolution. | |
| 19 // The service is also responsible for answering MediaSink queries. | |
|
imcheng
2017/02/07 00:48:13
Can you also document threading assumptions? e.g.,
zhaobin
2017/02/07 02:38:50
Done.
| |
| 20 class MediaSinkService { | |
|
imcheng
2017/02/07 00:48:14
Please also define a virtual destructor.
zhaobin
2017/02/07 02:38:50
Done.
| |
| 21 public: | |
| 22 // Callback used for |Start()|. | |
| 23 // Arg 0: |this| | |
| 24 // Arg 1: Sinks discovered and resolved by the service. | |
| 25 using OnSinksDiscoveredCallback = | |
| 26 base::Callback<void(const const MediaSinkService*, | |
|
imcheng
2017/02/07 00:48:13
Hmm, not quite sure if we still need to pass |this
zhaobin
2017/02/07 02:38:50
Done.
| |
| 27 const std::vector<MediaSink>&)>; | |
| 28 | |
| 29 // Starts sink discovery. No-ops if already started. | |
| 30 // Sinks discovered and resolved are continuously passed to | |
| 31 // |callback|. | |
| 32 virtual void Start(const OnSinksDiscoveredCallback& callback) = 0; | |
| 33 | |
| 34 // Adds a sink query to observe for MediaSink updates. | |
| 35 // Only one observer can be added for a given MediaSource. | |
| 36 // Start() must be called first. This class does not take | |
| 37 // ownership of |observer|. | |
| 38 virtual void AddSinkQuery(MediaSinksObserver* observer) = 0; | |
| 39 | |
| 40 // Removes a sink query and stop observing for MediaSink updates. | |
| 41 virtual void RemoveSinkQuery(MediaSinksObserver* observer) = 0; | |
| 42 }; | |
| 43 | |
| 44 } // namespace media_router | |
| 45 | |
| 46 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ | |
| OLD | NEW |