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 }; |
| 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; |
| 41 |
| 42 MediaSource source_; |
| 43 |
| 44 // This field will be set by MediaRouterImpl, and must be false by |
| 45 // this instance's destruction. |
| 46 bool registered_; |
| 47 }; |
| 48 |
| 49 } // namespace media_router |
| 50 |
| 51 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |
| 52 |
OLD | NEW |