Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module media_router.interfaces; | 5 module media_router.interfaces; |
| 6 | 6 |
| 7 // Represents an output sink to which media can be routed. | 7 // Represents an output sink to which media can be routed. |
| 8 struct MediaSink { | 8 struct MediaSink { |
| 9 enum IconType { | 9 enum IconType { |
| 10 CAST, | 10 CAST, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 // (See CreateRoute for additional documentation) | 136 // (See CreateRoute for additional documentation) |
| 137 // If the operation was successful, |route| will be defined and | 137 // If the operation was successful, |route| will be defined and |
| 138 // |error_text| will be null. | 138 // |error_text| will be null. |
| 139 // If the operation failed, |route| will be null and |error_text| | 139 // If the operation failed, |route| will be null and |error_text| |
| 140 // will be set. | 140 // will be set. |
| 141 JoinRoute(string media_source, | 141 JoinRoute(string media_source, |
| 142 string presentation_id, | 142 string presentation_id, |
| 143 string origin, | 143 string origin, |
| 144 int32 tab_id) => (MediaRoute? route, string? error_text); | 144 int32 tab_id) => (MediaRoute? route, string? error_text); |
| 145 | 145 |
| 146 // Connects an established route given by |route_id| with | |
| 147 // |media_source|. | |
|
mark a. foltz
2016/01/05 18:39:40
Extra newline.
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 148 // |origin| and |tab_id| are used for validating same-origin/tab scopes. | |
| 149 // (See CreateRoute for additional documentation) | |
| 150 // If the operation was successful, |route| will be defined and | |
| 151 // |error_text| will be null. | |
|
mark a. foltz
2016/01/05 18:39:40
Extra whitespace after //
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 152 // If the operation failed, |route| will be null and |error_text| | |
| 153 // will be set. | |
|
mark a. foltz
2016/01/05 18:39:40
Ditto
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 154 ConnectRouteByRouteId(string media_source, | |
| 155 string route_id, | |
| 156 string presentation_id, | |
|
mark a. foltz
2016/01/05 18:39:40
Document use of |presentation_id|
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 157 string origin, | |
| 158 int32 tab_id) => | |
| 159 (MediaRoute? route, string? error_text); | |
| 160 | |
| 146 // Closes the route specified by |route_id|. | 161 // Closes the route specified by |route_id|. |
| 147 CloseRoute(string route_id); | 162 CloseRoute(string route_id); |
| 148 | 163 |
| 149 // Sends |message| via the media route |media_route_id|. | 164 // Sends |message| via the media route |media_route_id|. |
| 150 // If the operation was successful, |sent| is true; otherwise it is false. | 165 // If the operation was successful, |sent| is true; otherwise it is false. |
| 151 SendRouteMessage(string media_route_id, string message) => (bool sent); | 166 SendRouteMessage(string media_route_id, string message) => (bool sent); |
| 152 | 167 |
| 153 // Sends |data| via the media route |media_route_id|. | 168 // Sends |data| via the media route |media_route_id|. |
| 154 // If the operation was successful, |sent| is true; otherwise it is false. | 169 // If the operation was successful, |sent| is true; otherwise it is false. |
| 155 SendRouteBinaryMessage(string media_route_id, array<uint8> data) | 170 SendRouteBinaryMessage(string media_route_id, array<uint8> data) |
| 156 => (bool sent); | 171 => (bool sent); |
| 157 | 172 |
| 158 // Starts querying for sinks capable of displaying |media_source|. | 173 // Starts querying for sinks capable of displaying |media_source|. |
| 159 StartObservingMediaSinks(string media_source); | 174 StartObservingMediaSinks(string media_source); |
| 160 | 175 |
| 161 // Stops querying sinks for |media_source|. | 176 // Stops querying sinks for |media_source|. |
| 162 StopObservingMediaSinks(string media_source); | 177 StopObservingMediaSinks(string media_source); |
| 163 | 178 |
| 164 // Starts reporting the state of active media routes via | 179 // Starts reporting the state of active media routes via |
| 165 // OnRoutesUpdated(). Querying will continue until | 180 // |OnRoutesUpdated()| in the context of the |media_source|. The |
| 166 // StopObservingMediaRoutes() is called. | 181 // |media_source| represents the application interested in the media |
| 167 StartObservingMediaRoutes(); | 182 // routes (usually the web page from which the content originates). |
| 183 // If no |media_source| is given, this should be considered a | |
| 184 // headless observer (e.g. a remote control) that has no interest in | |
|
mark a. foltz
2016/01/05 18:39:40
maybe "this should be considered an observer that
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 185 // joining a route. The |media_source| should be considered when | |
| 186 // returning joinable routes in the |OnRoutesUpdated()| call. If an empty | |
| 187 // |media_source| is given, there is no context in which a joinable | |
| 188 // route makes sense and therefore, there should not be any joinable | |
| 189 // routes returned in |OnRoutesUpdated()|. Querying will continue until | |
| 190 // |StopObservingMediaRoutes()| is called with the same | |
| 191 // |media_source| (even if it's an empty string). | |
| 192 StartObservingMediaRoutes(string media_source); | |
| 168 | 193 |
| 169 // Stops querying the state of all media routes. | 194 // Stops querying the state of all media routes in the context of |
| 170 StopObservingMediaRoutes(); | 195 // the |media_source|. |StartObservingMediaRoutes()| has |
| 196 // to be called with the same |media_source| for this to have any effect even | |
| 197 // if it's emtpy. Thus, |StartObservingMediaRoutes(media_source)| must be | |
|
mark a. foltz
2016/01/05 18:39:40
typo in empty
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 198 // matched with |StopObservingMediaRoutes(media_soruce)|. | |
|
mark a. foltz
2016/01/05 18:39:40
typo in source
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 199 // Calling |StopObservingMediaRoutes()| without a media_source will stop | |
|
mark a. foltz
2016/01/05 18:39:40
The style I like is to use pipes around parameters
matt.boetger
2016/01/06 22:49:07
Done.
| |
| 200 // any media routes queries associated with emtpy strings (queries | |
| 201 // that being with |StartObservingMediaRoutes()|). | |
| 202 StopObservingMediaRoutes(string media_source); | |
| 171 | 203 |
| 172 // Called when the MediaRouter is ready to get the next batch of messages | 204 // Called when the MediaRouter is ready to get the next batch of messages |
| 173 // associated with |route_id|. | 205 // associated with |route_id|. |
| 174 // |messages| returned will contain the batch of messages. | 206 // |messages| returned will contain the batch of messages. |
| 175 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. | 207 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. |
| 176 // |error| indicates if a permanent error occurred. If true, then subsequent | 208 // |error| indicates if a permanent error occurred. If true, then subsequent |
| 177 // calls will also return with |error| being true. | 209 // calls will also return with |error| being true. |
| 178 ListenForRouteMessages(string route_id) => | 210 ListenForRouteMessages(string route_id) => |
| 179 (array<RouteMessage> messages, bool error); | 211 (array<RouteMessage> messages, bool error); |
| 180 | 212 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 // process. | 247 // process. |
| 216 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => | 248 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => |
| 217 (string instance_id); | 249 (string instance_id); |
| 218 | 250 |
| 219 // Called when the Media Route Manager receives a new list of sinks. | 251 // Called when the Media Route Manager receives a new list of sinks. |
| 220 OnSinksReceived(string media_source, array<MediaSink> sinks); | 252 OnSinksReceived(string media_source, array<MediaSink> sinks); |
| 221 | 253 |
| 222 // Called when issues are reported for media routes. | 254 // Called when issues are reported for media routes. |
| 223 OnIssue(Issue issue); | 255 OnIssue(Issue issue); |
| 224 | 256 |
| 225 // Called when list of routes has been updated. | 257 // Called when list of routes has been updated in the context of the |
| 226 OnRoutesUpdated(array<MediaRoute> routes); | 258 // calling |media_source|. The array |joinable_route_ids| should |
| 259 // contain route IDs of joinable routes found in the |routes| array. | |
| 260 OnRoutesUpdated(array<MediaRoute> routes, string media_source, | |
| 261 array<string> joinable_route_ids); | |
| 227 | 262 |
| 228 // Called when the overall availability of media sinks has been updated. | 263 // Called when the overall availability of media sinks has been updated. |
| 229 OnSinkAvailabilityUpdated(SinkAvailability availability); | 264 OnSinkAvailabilityUpdated(SinkAvailability availability); |
| 230 | 265 |
| 231 // Called when the state of presentation connected to route |route_id| has | 266 // Called when the state of presentation connected to route |route_id| has |
| 232 // changed to |state|. | 267 // changed to |state|. |
| 233 OnPresentationConnectionStateChanged( | 268 OnPresentationConnectionStateChanged( |
| 234 string route_id, PresentationConnectionState state); | 269 string route_id, PresentationConnectionState state); |
| 235 }; | 270 }; |
| 236 | 271 |
| OLD | NEW |