OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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_SINKS_OBSERVER_H_ | |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "chrome/browser/media/router/media_sink.h" | |
11 #include "chrome/browser/media/router/media_source.h" | |
12 | |
13 namespace media_router { | |
14 | |
15 struct SinksQueryResult { | |
16 SinksQueryResult(); | |
17 ~SinksQueryResult(); | |
18 | |
19 std::vector<MediaSink> sinks; | |
20 }; | |
xhwang
2015/04/02 17:13:03
Do you plan to add more values to the result? Can
imcheng
2015/04/02 23:05:24
Right now we don't plan to add any more. I am not
| |
21 | |
22 // Base class for observing when the collection of sinks compatible with | |
23 // a MediaSource has been updated. | |
24 // A MediaSinksObserver implementation can be registered to MediaRouter to | |
25 // receive results. It can then interpret / process the results accordingly. | |
26 class MediaSinksObserver { | |
27 public: | |
28 // Constructs an observer that will observe for sinks compatible | |
29 // with |source|. | |
30 explicit MediaSinksObserver(const MediaSource& source); | |
31 virtual ~MediaSinksObserver(); | |
32 | |
33 // This function is invoked when the list of sinks compatible | |
34 // with |source_| has been updated. | |
35 virtual void OnSinksReceived(const SinksQueryResult& result) {} | |
36 | |
37 const MediaSource& source() const { return source_; } | |
38 | |
39 private: | |
40 friend class MediaRouterImpl; | |
xhwang
2015/04/02 17:13:03
MediaSinksObserver seems to be an interface, but w
imcheng
2015/04/02 23:05:24
Yes. source() by media router in determining the s
xhwang
2015/04/06 20:51:30
How do you plan implement "MediaRouter send update
imcheng
2015/04/06 21:54:20
MediaRouter will keep a map from source to a set o
| |
41 | |
42 MediaSource source_; | |
43 | |
44 // Whether the observer is registered to the Media Router. | |
45 // This field will be set by MediaRouterImpl, and must be false by | |
46 // this instance's destruction. This is used to detect if the observer | |
47 // is being destroyed while still registered to the Media Router. | |
48 bool registered_; | |
49 }; | |
50 | |
51 } // namespace media_router | |
52 | |
53 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ | |
54 | |
OLD | NEW |