Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1243)

Unified Diff: chrome/browser/media/router/media_sink_service.h

Issue 2662393005: [Media Router] (device discovery) Create MediaSinkService interface (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..67dbcc7162135f2ed9103025bfe7800f960a9ba5
--- /dev/null
+++ b/chrome/browser/media/router/media_sink_service.h
@@ -0,0 +1,46 @@
+// 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>
+
+#include "base/callback_list.h"
imcheng 2017/02/07 00:48:14 Did you mean to include base/callback.h ?
zhaobin 2017/02/07 02:38:50 Done.
+#include "chrome/browser/media/router/media_sink.h"
+
+namespace media_router {
+
+class MediaSinksObserver;
+
+// MediaSinkService defines an interface which can be implemented by DIAL, Cast
imcheng 2017/02/07 00:48:13 Comment suggestion: A service which can be used t
zhaobin 2017/02/07 02:38:50 Done.
+// or future protocols to produce MediaSinks from device discovery/resolution.
+// The service is also responsible for answering MediaSink queries.
imcheng 2017/02/07 00:48:13 Can you also document threading assumptions? e.g.,
zhaobin 2017/02/07 02:38:50 Done.
+class MediaSinkService {
imcheng 2017/02/07 00:48:14 Please also define a virtual destructor.
zhaobin 2017/02/07 02:38:50 Done.
+ public:
+ // Callback used for |Start()|.
+ // Arg 0: |this|
+ // Arg 1: Sinks discovered and resolved by the service.
+ using OnSinksDiscoveredCallback =
+ base::Callback<void(const const MediaSinkService*,
imcheng 2017/02/07 00:48:13 Hmm, not quite sure if we still need to pass |this
zhaobin 2017/02/07 02:38:50 Done.
+ const std::vector<MediaSink>&)>;
+
+ // 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_
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698