OLD | NEW |
---|---|
(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 // Implementations of this class live in the browser process and is responsible | |
21 // 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.
| |
22 // 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'
| |
23 // In particular, this class forwards requests from Media Router to Media Route | |
24 // Providers and responses from Media Route Providers to Media Router. | |
25 class MediaRouteProviderManagerHost { | |
26 public: | |
27 virtual ~MediaRouteProviderManagerHost() {} | |
28 | |
29 // Delegate called by the MediaRouteProviderManagerHost when a message is | |
30 // received from the Media Route Provider Manager. | |
xhwang
2015/04/08 20:32:52
ditto
imcheng
2015/04/08 23:28:09
Acknowledged.
| |
31 class Delegate { | |
32 public: | |
33 virtual ~Delegate() {} | |
34 | |
35 // Called when results from a media sinks query have been received. | |
36 // |source|: Media source of the query. | |
37 // |sinks|: List of sinks compatible with the source. | |
38 virtual void OnSinksReceived(const MediaSource& source, | |
39 const std::vector<MediaSink>& sinks) = 0; | |
40 | |
41 // Called when there is a message from a route. | |
42 // |route_id|: The route ID. | |
43 // |message|: The message. | |
44 virtual void OnMessage(const MediaRouteId& route_id, | |
45 const std::string& message) = 0; | |
46 | |
47 // Called when a response to a route request has been received. | |
48 // |request_id|: ID of original request. | |
49 // |route|: Description of the established route. If an error | |
50 // occurred while establishing a route, then |route| is nullptr. | |
51 // |error_text|: Description of error. Non-empty if an error | |
52 // occurred while establishing a route. | |
53 virtual void OnRouteResponseReceived(const RouteRequestId& request_id, | |
54 scoped_ptr<MediaRoute> route, | |
55 const std::string& error_text) = 0; | |
56 | |
57 // Called when the list of current MediaRoutes and their MediaSinks | |
58 // has been updated. | |
59 // |routes|: List of MediaRoutes. | |
60 // |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.
| |
61 virtual void OnRoutesUpdated(const std::vector<MediaRoute>& routes) = 0; | |
62 | |
63 // Called when the MRPMHost is being destroyed. | |
64 virtual void OnHostDestroyed(MediaRouteProviderManagerHost* host) = 0; | |
65 }; | |
66 | |
67 // The following APIs allow the media router to send commands to the MRPM. | |
68 | |
69 // Instructs MRPM to start a query for compatible media sinks for |source|. | |
70 // Results from the query and subsequent updates will be received via | |
71 // |Delegate::OnSinksReceived| until |RemoveMediaSinksQuery| is called. | |
72 virtual void AddMediaSinksQuery(const MediaSource& source) = 0; | |
73 | |
74 // Instructs MRPM to stop a query for compatible media sinks for |source|. | |
75 // The delegate will no longer receive updates. | |
76 virtual void RemoveMediaSinksQuery(const MediaSource& source) = 0; | |
77 | |
78 // Requests MRPM to establish a route between |source| and a media sink given | |
79 // by |sink_id|. |request_id| is generated by Media Router and passed | |
80 // to MRPM to identify the request. | |
81 // Result of the request will be received via | |
82 // |Delegate::OnRouteResponseReceived|. | |
83 virtual void RequestRoute(const RouteRequestId& request_id, | |
84 const MediaSource& source, | |
85 const MediaSinkId& sink_id) = 0; | |
86 | |
87 // Requests MRPM to close a route specified by |route_id|. | |
88 virtual void CloseRoute(const MediaRouteId& route_id) = 0; | |
89 | |
90 // Requests MRPM to post |message| to a MediaSink connected by MediaRoute | |
91 // with |route_id|. | |
92 virtual void PostMessage(const MediaRouteId& route_id, | |
93 const std::string& message) = 0; | |
94 | |
95 // Requests MRPM to start a query for all MediaRoutes and their MediaSinks. | |
96 // The result and subsequent updates will be received via | |
97 // |Delegate::OnRoutesUpdated| until |StopMediaRoutesQuery| is called. | |
98 virtual void StartMediaRoutesQuery() = 0; | |
99 | |
100 // Requests MRPM to stop the query. The delegate will no longer receive | |
101 // updates. | |
102 virtual void StopMediaRoutesQuery() = 0; | |
103 }; | |
104 | |
105 } // namespace media_router | |
106 | |
107 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_ | |
OLD | NEW |