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

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

Issue 1020743003: [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Xiaohan's 3rd set of comments Created 5 years, 8 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/media_route.h ('k') | chrome/browser/media/router/media_route_response.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/router/media_route_provider_manager_host.h
diff --git a/chrome/browser/media/router/media_route_provider_manager_host.h b/chrome/browser/media/router/media_route_provider_manager_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..21a78def7b6fc90577aaa4f85f95d013a75675fc
--- /dev/null
+++ b/chrome/browser/media/router/media_route_provider_manager_host.h
@@ -0,0 +1,107 @@
+// 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_ROUTE_PROVIDER_MANAGER_HOST_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
+
+#include <string>
+#include <vector>
+
+#include "base/callback.h"
+#include "chrome/browser/media/router/media_route.h"
+#include "chrome/browser/media/router/media_sink.h"
+#include "chrome/browser/media/router/media_source.h"
+
+namespace media_router {
+
+class MediaRoute;
+
+// Implementations of this class live in the browser process and is responsible
+// for handling cross-process communication between the Media Router (in browser
xhwang 2015/04/08 20:32:51 s/Media Router/MediaRouter
imcheng 2015/04/08 23:28:09 File removed.
+// process) and the Media Route Provider Manager (outside of browser process).
xhwang 2015/04/08 20:32:52 s/Media Route Provider Manager/MediaRouteProviderM
imcheng 2015/04/08 23:28:09 "Media Route Provider Manager" is correct. We don'
+// In particular, this class forwards requests from Media Router to Media Route
+// Providers and responses from Media Route Providers to Media Router.
+class MediaRouteProviderManagerHost {
+ public:
+ virtual ~MediaRouteProviderManagerHost() {}
+
+ // Delegate called by the MediaRouteProviderManagerHost when a message is
+ // received from the Media Route Provider Manager.
xhwang 2015/04/08 20:32:52 ditto
imcheng 2015/04/08 23:28:09 Acknowledged.
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ // Called when results from a media sinks query have been received.
+ // |source|: Media source of the query.
+ // |sinks|: List of sinks compatible with the source.
+ virtual void OnSinksReceived(const MediaSource& source,
+ const std::vector<MediaSink>& sinks) = 0;
+
+ // Called when there is a message from a route.
+ // |route_id|: The route ID.
+ // |message|: The message.
+ virtual void OnMessage(const MediaRouteId& route_id,
+ const std::string& message) = 0;
+
+ // Called when a response to a route request has been received.
+ // |request_id|: ID of original request.
+ // |route|: Description of the established route. If an error
+ // occurred while establishing a route, then |route| is nullptr.
+ // |error_text|: Description of error. Non-empty if an error
+ // occurred while establishing a route.
+ virtual void OnRouteResponseReceived(const RouteRequestId& request_id,
+ scoped_ptr<MediaRoute> route,
+ const std::string& error_text) = 0;
+
+ // Called when the list of current MediaRoutes and their MediaSinks
+ // has been updated.
+ // |routes|: List of MediaRoutes.
+ // |sinks|: List of MediaSinks associated with the routes.
xhwang 2015/04/08 20:32:52 Also drop MediaSinks and |sinks| here.
imcheng 2015/04/08 23:28:09 Done.
+ virtual void OnRoutesUpdated(const std::vector<MediaRoute>& routes) = 0;
+
+ // Called when the MRPMHost is being destroyed.
+ virtual void OnHostDestroyed(MediaRouteProviderManagerHost* host) = 0;
+ };
+
+ // The following APIs allow the media router to send commands to the MRPM.
+
+ // Instructs MRPM to start a query for compatible media sinks for |source|.
+ // Results from the query and subsequent updates will be received via
+ // |Delegate::OnSinksReceived| until |RemoveMediaSinksQuery| is called.
+ virtual void AddMediaSinksQuery(const MediaSource& source) = 0;
+
+ // Instructs MRPM to stop a query for compatible media sinks for |source|.
+ // The delegate will no longer receive updates.
+ virtual void RemoveMediaSinksQuery(const MediaSource& source) = 0;
+
+ // Requests MRPM to establish a route between |source| and a media sink given
+ // by |sink_id|. |request_id| is generated by Media Router and passed
+ // to MRPM to identify the request.
+ // Result of the request will be received via
+ // |Delegate::OnRouteResponseReceived|.
+ virtual void RequestRoute(const RouteRequestId& request_id,
+ const MediaSource& source,
+ const MediaSinkId& sink_id) = 0;
+
+ // Requests MRPM to close a route specified by |route_id|.
+ virtual void CloseRoute(const MediaRouteId& route_id) = 0;
+
+ // Requests MRPM to post |message| to a MediaSink connected by MediaRoute
+ // with |route_id|.
+ virtual void PostMessage(const MediaRouteId& route_id,
+ const std::string& message) = 0;
+
+ // Requests MRPM to start a query for all MediaRoutes and their MediaSinks.
+ // The result and subsequent updates will be received via
+ // |Delegate::OnRoutesUpdated| until |StopMediaRoutesQuery| is called.
+ virtual void StartMediaRoutesQuery() = 0;
+
+ // Requests MRPM to stop the query. The delegate will no longer receive
+ // updates.
+ virtual void StopMediaRoutesQuery() = 0;
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
« no previous file with comments | « chrome/browser/media/router/media_route.h ('k') | chrome/browser/media/router/media_route_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698