Index: chrome/browser/media/router/media_routes_observer.h |
diff --git a/chrome/browser/media/router/media_routes_observer.h b/chrome/browser/media/router/media_routes_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6f8ee2c0b2cedba5581611bca7f9c7a78c45e750 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_routes_observer.h |
@@ -0,0 +1,46 @@ |
+// 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_ROUTES_OBSERVER_H_ |
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTES_OBSERVER_H_ |
+ |
+#include <vector> |
+ |
+#include "chrome/browser/media/router/media_route.h" |
+#include "chrome/browser/media/router/media_sink.h" |
+ |
+namespace media_router { |
+ |
+struct RoutesQueryResult { |
xhwang
2015/04/02 17:13:03
Can we just pass two parameters in OnRoutesUpdated
imcheng
2015/04/02 23:05:24
Done.
|
+ RoutesQueryResult(); |
+ ~RoutesQueryResult(); |
+ |
+ std::vector<MediaRoute> routes; |
+ std::vector<MediaSink> sinks; |
xhwang
2015/04/02 17:13:03
A MediaRoute has one MediaSource and one MediaSink
imcheng
2015/04/02 23:05:24
Good point. Since we now have MediaSink in MediaRo
|
+}; |
+ |
+// Base class for observing when the set of MediaRoutes and their associated |
+// MediaSinks have been updated. |
+class MediaRoutesObserver { |
+ public: |
+ MediaRoutesObserver(); |
+ virtual ~MediaRoutesObserver(); |
+ |
+ // This function is invoked when the list of routes and their associated |
+ // sinks have been updated. |
+ virtual void OnRoutesUpdated(const RoutesQueryResult& result) {} |
+ |
+ private: |
+ friend class MediaRouterImpl; |
+ |
+ // 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_ROUTES_OBSERVER_H_ |