OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
xhwang
2015/04/28 06:08:18
tip: Next time upload a PS with all changes withou
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Defines communication between the Media Router and the | |
6 // Media Router Provider Manager. | |
7 | |
8 module media_router.interfaces; | |
9 | |
10 // Represents an output sink to which media can be routed. | |
11 struct MediaSink { | |
12 // The sink identifier, e.g. "rs71w7mFzYLFlabir_qO4NHl6SUc." | |
13 string sink_id; | |
14 // The human-readable name, e.g. "Janet's Chromecast". | |
15 string name; | |
16 }; | |
17 | |
18 // Should be kept in sync with media_route.h. | |
19 struct MediaRoute { | |
20 // The ID of this media route, e.g. "r_PR1O_blkC9dsKp-tb1ti8qurOo". | |
21 string media_route_id; | |
22 // The ID of the media source being sent through this media route. | |
23 // May be missing if route is not local. | |
24 string? media_source; | |
25 // The ID of the sink receiving the media. | |
26 // e.g. "rs71w7mFzYLFlabir_qO4NHl6SUc." | |
27 string sink_id; | |
28 // Human readable name of the sink. | |
29 string sink_name; | |
xhwang
2015/04/28 06:08:18
Can you replace this two with
MediaSink media_sin
| |
30 // Human readable description of this route, e.g. | |
31 // "Tab casting". | |
32 string description; | |
33 // An icon that is associated with this media source. | |
34 string? icon_url; | |
35 // Specifies that the route is requested locally. | |
36 bool is_local; | |
37 }; | |
38 | |
39 // Notifications or an actionable events to be shown to the user. | |
40 // When is_blocking is true, media router UI shows issue only: | |
41 // | |
42 // Title | |
43 // Message | |
44 // default_action_button secondary_action_button | |
45 // | |
46 // When is_blocking is false, media router UI uses banner: | |
47 // | |
48 // Title default_action_link secondary_action_link | |
49 // | |
50 // above receiver list if route_id is not provided; otherwise it is | |
51 // above route detail and controls. | |
52 struct Issue { | |
53 enum Severity { | |
54 FATAL, | |
55 WARNING, | |
56 NOTIFICATION | |
57 }; | |
58 | |
59 enum ActionType { | |
60 OK, | |
61 CANCEL, | |
62 DISMISS, | |
63 LEARN_MORE | |
64 }; | |
65 | |
66 // If set, the ID of the route to which this issue pertains. | |
67 // If not set (default), then this is a global issue. | |
68 string? route_id; | |
69 | |
70 Severity severity; | |
71 | |
72 // When true, the issue must be presented to the user and resolved | |
73 // before other actions are allowed. | |
74 bool is_blocking; | |
75 | |
76 // Short description about the issue. | |
77 string title; | |
78 | |
79 // Message about issue detail or how to handle issue. | |
80 // Messages should be suitable for end users to decide which actions to take. | |
81 string? message; | |
82 | |
83 ActionType default_action; | |
84 | |
85 array<ActionType>? secondary_actions; | |
86 | |
87 // A help page to be opened if users select learn_more. | |
88 string? help_url; | |
89 }; | |
90 | |
91 // Interface for sending messages from the Media Router to the | |
92 // Media Router Provider Manager. | |
93 interface ProviderManagerService { | |
xhwang
2015/04/28 06:08:18
I am still not sure about this naming. Can you jus
Kevin M
2015/04/28 17:20:29
Based on our discussion about the "Client" naming
| |
94 // Signals the client to route the media located | |
xhwang
2015/04/28 06:08:18
What is a "client"? Maybe just s/client/MediaRoute
Kevin M
2015/04/28 17:20:30
The call is originating from the MR and sent to th
| |
95 // at |media_source| to |sink_id|. | |
96 // If the operation was successful, |route| will be defined and | |
97 // |error_text| will be null. | |
98 // If the operation failed, |route| will be null and |error_text| | |
99 // will be set. | |
100 CreateRoute(string media_source, string sink_id) => | |
101 (MediaRoute? route, string? error_text); | |
xhwang
2015/04/28 06:08:18
Is this equivalent to c++ MediaRoutner::RequestRou
Kevin M
2015/04/28 17:20:30
Yes. We changed it to CreateRoute because "request
| |
102 | |
103 // Signals the client to join an established route given by |presentation_id| | |
104 // with media located at |media_source|. |origin| and |tab_id| are used for | |
105 // enforcing same origin/tab scopes. | |
106 // Returns the route on success. Otherwise an error message is returned. | |
107 JoinRoute(string media_source, | |
108 string presentation_id, | |
109 string origin, | |
110 int64 tab_id) => (MediaRoute? route, string? error_text); | |
111 | |
112 // Signals the client to close the route specified by |route_id|. | |
113 CloseRoute(string route_id); | |
114 | |
115 // Sends |message| with optional |extra_info_json| via the media route | |
116 // |media_route_id|. | |
117 PostMessage(string media_route_id, string message); | |
118 | |
119 // Signals the client to start querying for sinks | |
120 // capable of displaying |media_source|. | |
121 StartObservingMediaSinks(string media_source); | |
122 | |
123 // Signals the client to stop querying for sinks | |
124 // capable of displaying |media_source|. | |
125 StopObservingMediaSinks(string media_source); | |
126 | |
127 // Signals the to start a query on all routes. Updates are received from | |
128 // |OnRoutesUpdated()|. | |
129 StartObservingMediaRoutes(); | |
130 | |
131 // Signals the to stop query on all routes. | |
132 StopObservingMediaRoutes(); | |
133 | |
134 // "Clears" an issue after it has been processed. | |
135 ClearIssue(string issue_id); | |
136 }; | |
137 | |
138 // Interface for sending messages from the client to the MR. | |
139 interface MediaRouter { | |
140 // Sets a service object for issuing calls back to the MRPM. | |
141 // Returns a string that uniquely identifies the Media Router browser | |
142 // process. | |
143 SetProviderManagerService(ProviderManagerService observer) => | |
144 (string instance_id); | |
145 | |
146 // Called when the Media Route Manager receives a new list of sinks. | |
147 OnSinksReceived(string media_source, array<MediaSink> sinks); | |
148 | |
149 // Called when the Media Route Manager receives a route message. | |
150 OnMessage(string media_source, string message); | |
151 | |
152 // Called when providers send an issue. | |
153 OnIssue(Issue issue); | |
154 | |
155 // Called when list of routes has been updated. | |
156 OnRoutesUpdated(array<MediaRoute> routes); | |
157 }; | |
OLD | NEW |