Index: chrome/browser/media/router/media_sink_service.h |
diff --git a/chrome/browser/media/router/media_sink_service.h b/chrome/browser/media/router/media_sink_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f3408eecf7f661c81d769c86d88af42c8e4585a2 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_sink_service.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2017 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_SINK_SERVICE_H_ |
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ |
+ |
+#include <memory> |
imcheng
2017/02/07 19:25:31
#include <vector>
zhaobin
2017/02/07 22:58:45
Done.
|
+ |
+#include "base/callback.h" |
+#include "chrome/browser/media/router/media_sink.h" |
+ |
+namespace media_router { |
+ |
+class MediaSinksObserver; |
+ |
+// A service which can be used to start device discovery and resolution in the |
+// background to generate MediaSinks. In addition, the service is capable of |
+// answering MediaSink queries using the sinks that it generated. This class is |
imcheng
2017/02/07 19:25:31
nit: start the sentence about thread safety in a n
zhaobin
2017/02/07 22:58:45
Done.
|
+// not thread safe. All methods must be called from the UI thread. |
+class MediaSinkService { |
+ public: |
+ // Callback used for |Start()|. |
+ // Arg 0: Sinks discovered and resolved by the service. |
+ using OnSinksDiscoveredCallback = |
+ base::Callback<void(const std::vector<MediaSink>&)>; |
imcheng
2017/02/07 19:25:31
Since we are defining subtypes of MediaSink in ano
zhaobin
2017/02/07 22:58:45
Done.
|
+ |
+ virtual ~MediaSinkService() = default; |
+ |
+ // Starts sink discovery. No-ops if already started. |
+ // Sinks discovered and resolved are continuously passed to |
+ // |callback|. |
+ virtual void Start(const OnSinksDiscoveredCallback& callback) = 0; |
+ |
+ // Adds a sink query to observe for MediaSink updates. |
+ // Only one observer can be added for a given MediaSource. |
+ // Start() must be called first. This class does not take |
+ // ownership of |observer|. |
+ virtual void AddSinkQuery(MediaSinksObserver* observer) = 0; |
+ |
+ // Removes a sink query and stop observing for MediaSink updates. |
+ virtual void RemoveSinkQuery(MediaSinksObserver* observer) = 0; |
+}; |
+ |
+} // namespace media_router |
+ |
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_SERVICE_H_ |