Index: chrome/browser/media/router/media_sinks_observer.h |
diff --git a/chrome/browser/media/router/media_sinks_observer.h b/chrome/browser/media/router/media_sinks_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ffa0503979cf42015d88ab4ae2741fe40d2489a4 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_sinks_observer.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |
+ |
+#include <vector> |
+ |
+#include "chrome/browser/media/router/media_sink.h" |
+#include "chrome/browser/media/router/media_source.h" |
+ |
+namespace media_router { |
+ |
+struct SinksQueryResult { |
+ SinksQueryResult(); |
+ ~SinksQueryResult(); |
+ |
+ std::vector<MediaSink> sinks; |
+}; |
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
|
+ |
+// Base class for observing when the collection of sinks compatible with |
+// a MediaSource has been updated. |
+// A MediaSinksObserver implementation can be registered to MediaRouter to |
+// receive results. It can then interpret / process the results accordingly. |
+class MediaSinksObserver { |
+ public: |
+ // Constructs an observer that will observe for sinks compatible |
+ // with |source|. |
+ explicit MediaSinksObserver(const MediaSource& source); |
+ virtual ~MediaSinksObserver(); |
+ |
+ // This function is invoked when the list of sinks compatible |
+ // with |source_| has been updated. |
+ virtual void OnSinksReceived(const SinksQueryResult& result) {} |
+ |
+ const MediaSource& source() const { return source_; } |
+ |
+ private: |
+ 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
|
+ |
+ MediaSource source_; |
+ |
+ // Whether the observer is registered to the Media Router. |
+ // This field will be set by MediaRouterImpl, and must be false by |
+ // this instance's destruction. This is used to detect if the observer |
+ // is being destroyed while still registered to the Media Router. |
+ bool registered_; |
+}; |
+ |
+} // namespace media_router |
+ |
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_ |
+ |