Chromium Code Reviews| 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 { | |
|
mark a. foltz
2015/03/27 21:21:59
Should this be a using declaration for std::vector
imcheng
2015/03/30 22:49:10
The latter.
| |
| 16 SinksQueryResult(); | |
| 17 ~SinksQueryResult(); | |
| 18 | |
| 19 std::vector<MediaSink> sinks; | |
| 20 }; | |
| 21 | |
| 22 // Interface for observing when the collection of sinks compatible with | |
|
mark a. foltz
2015/03/27 21:21:59
Not an interface.
imcheng
2015/03/30 22:49:10
Ok, let's call it base class and provide a no-op i
| |
| 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) : source_(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) = 0; | |
|
mark a. foltz
2015/03/27 21:21:59
The API is a little limiting in that there must be
imcheng
2015/03/30 22:49:10
Agreed. WebContentsObserver follow a similar model
| |
| 36 | |
| 37 const MediaSource& source() const { return source_; } | |
| 38 | |
| 39 private: | |
| 40 MediaSource source_; | |
| 41 }; | |
| 42 | |
| 43 } // namespace media_router | |
| 44 | |
| 45 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ | |
| OLD | NEW |