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

Side by Side 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 Kevin's 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "chrome/browser/media/router/media_route.h"
13 #include "chrome/browser/media/router/media_sink.h"
14 #include "chrome/browser/media/router/media_source.h"
15
16 namespace media_router {
17
18 class MediaRoute;
19
20 // Acts as the Chrome endpoint for communication between Media Router and
21 // Media Route Providers (via the Media Route Provider Manager).
22 class MediaRouteProviderManagerHost {
23 public:
24 virtual ~MediaRouteProviderManagerHost() {}
25
26 // Delegate called by the MediaRouteProviderManagerHost when a response is
27 // received from the MRPM.
28 class Delegate {
xhwang 2015/04/02 17:13:02 Please see comment below. For response of a partic
imcheng 2015/04/02 23:05:23 Thanks for the suggestion. Please refer to comment
29 public:
30 virtual ~Delegate() {}
31
32 // Called when results from a media sinks query have been received.
33 // |source|: Media source of the query.
34 // |sinks|: List of sinks compatible with the source.
35 // |routes|: Currently active routes on |sinks|.
xhwang 2015/04/02 17:13:02 I don't see |routes|.
imcheng 2015/04/02 23:05:23 Removed.
36 virtual void OnSinksReceived(const MediaSource& source,
37 const std::vector<MediaSink>& sinks) = 0;
38
39 // Called when there is a message from a route.
40 // |route_id|: The route ID.
41 // |message|: The message.
42 virtual void OnMessage(const MediaRouteId& route_id,
43 const std::string& message) = 0;
44
45 // Called when a response to a route request has been received and
46 // a route has been established.
47 // |request_id|: ID of original request.
48 // |route|: Description of the established route.
xhwang 2015/04/02 17:13:02 Can |route| be Empty()? In that case, is "a route
imcheng 2015/04/02 23:05:23 Since the "emtpy MediaRoute" has been reverted, it
49 virtual void OnRouteResponseReceived(const RouteRequestId& request_id,
50 const MediaRoute& route) = 0;
51
52 // Called when an error occurred while establishing a route.
53 // |request_id|: ID of original request.
54 // |error_text|: Text describing the error.
55 virtual void OnRouteResponseError(const RouteRequestId& request_id,
56 const std::string& error_text) = 0;
57
58 // Called when the list of currently MediaRoutes and their MediaSinks
59 // has been updated.
60 // |routes|: List of MediaRoutes.
61 // |sinks|: List of MediaSinks associated with the routes.
62 virtual void OnRoutesUpdated(
63 const std::vector<MediaRoute>& routes,
64 const std::vector<MediaSink>& sinks) = 0;
65
66 // Called when the MRPMHost is being destroyed.
67 virtual void OnHostDestroyed(MediaRouteProviderManagerHost* host) = 0;
68 };
69
70 // The following API allows the media router to send commands to the MRPM.
xhwang 2015/04/02 17:13:02 s/API allows/APIs allow/
imcheng 2015/04/02 23:05:23 Done.
71
72 // Instructs MRPM to start a query for compatible media sinks for |source|.
73 // Results from the query and subsequent updates will be received via
74 // |Delegate::OnSinksReceived| until the query is removed from MRPM
75 // via |RemoveMediaSinksQuery|.
76 virtual void AddMediaSinksQuery(const MediaSource& source) = 0;
xhwang 2015/04/02 17:13:02 Can we replace OnSinksReceived() with a callback h
imcheng 2015/04/02 23:05:24 We considered using callbacks here. But since AddM
xhwang 2015/04/06 20:51:29 Acknowledged.
77
78 // Instructs MRPM to stop a query for compatible media sinks for |source|.
79 virtual void RemoveMediaSinksQuery(const MediaSource& source) = 0;
80
81 // Requests MRPM to establish a route between |source| and a media sink given
82 // by |sink_id|. |request_id| is generated by Media Router and passed
83 // to MRPM to identify the request.
84 virtual void RequestRoute(const RouteRequestId& request_id,
xhwang 2015/04/02 17:13:02 Will the response be either OnRouteResponseReceive
imcheng 2015/04/02 23:05:23 Updated comment. I think that this is a place wher
xhwang 2015/04/06 20:51:29 Acknowledged.
85 const MediaSource& source,
86 const MediaSinkId& sink_id) = 0;
87
88 // Requests MRPM to close a route specified by |route_id|.
89 virtual void CloseRoute(const MediaRouteId& route_id) = 0;
90
91 // Requests MRPM to post |message| to a MediaSink connected by MediaRoute
92 // with |route_id|.
93 virtual void PostMessage(const MediaRouteId& route_id,
94 const std::string& message) = 0;
95
96 // Requests MRPM to send updates on all MediaRoutes and their MediaSinks.
97 // The updated lists will be received via
98 // |Delegate::OnActiveSinksAndRoutesReceived|.
xhwang 2015/04/02 17:13:02 This doesn't exist...
imcheng 2015/04/02 23:05:23 Updated comment.
99 virtual void StartMediaRoutesQuery() = 0;
100
101 // Requests MRPM to stop sending updates on MediaRoutes.
102 virtual void StopMediaRoutesQuery() = 0;
xhwang 2015/04/02 17:13:02 I am confused by Query vs Update...
imcheng 2015/04/02 23:05:24 Changed the comment here to match AddMediaSinksQue
103 };
104
105 } // namespace media_router
106
107 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698