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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // route given by |route_id|. | 199 // route given by |route_id|. |
200 // | 200 // |
201 // The presentation ID of the new route will be |presentation_id|, but it may | 201 // The presentation ID of the new route will be |presentation_id|, but it may |
202 // be overridden by a provider implementation. The presentation ID will be | 202 // be overridden by a provider implementation. The presentation ID will be |
203 // used by the presentation API to refer to the created route. | 203 // used by the presentation API to refer to the created route. |
204 // | 204 // |
205 // |origin| and |tab_id| are used for validating same-origin/tab scopes; see | 205 // |origin| and |tab_id| are used for validating same-origin/tab scopes; see |
206 // CreateRoute for additional documentation. | 206 // CreateRoute for additional documentation. |
207 // | 207 // |
208 // If |timeout_millis| is positive, it will be used in place of the default | 208 // If |timeout_millis| is positive, it will be used in place of the default |
209 // timeout defined by Media Route Provider Manager; see CreateRoute for additi
onal | 209 // timeout defined by Media Route Provider Manager; see CreateRoute for |
210 // documentation. | 210 // additional documentation. |
211 // | 211 // |
212 // If the route request was created by an off the record (incognito) profile, | 212 // If the route request was created by an off the record (incognito) profile, |
213 // |off_the_record| must be true. | 213 // |off_the_record| must be true. |
214 // | 214 // |
215 // If the operation was successful, |route| will be defined and | 215 // If the operation was successful, |route| will be defined and |
216 // |error_text| will be null. If the operation failed, |route| will be null | 216 // |error_text| will be null. If the operation failed, |route| will be null |
217 // and |error_text| will be set. | 217 // and |error_text| will be set. |
218 // | 218 // |
219 // |result| will be set to OK if successful, or an error code if an error | 219 // |result| will be set to OK if successful, or an error code if an error |
220 // occurred. | 220 // occurred. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // Stops querying the state of all media routes in the context of | 265 // Stops querying the state of all media routes in the context of |
266 // the |media_source|. StartObservingMediaRoutes() has | 266 // the |media_source|. StartObservingMediaRoutes() has |
267 // to be called with the same |media_source| for this to have any effect even | 267 // to be called with the same |media_source| for this to have any effect even |
268 // if it's empty. Thus, StartObservingMediaRoutes(media_source) must be | 268 // if it's empty. Thus, StartObservingMediaRoutes(media_source) must be |
269 // matched with StopObservingMediaRoutes(media_source). | 269 // matched with StopObservingMediaRoutes(media_source). |
270 // Calling StopObservingMediaRoutes() without a media_source will stop | 270 // Calling StopObservingMediaRoutes() without a media_source will stop |
271 // any media routes queries associated with emtpy strings (queries | 271 // any media routes queries associated with emtpy strings (queries |
272 // that being with StartObservingMediaRoutes()). | 272 // that being with StartObservingMediaRoutes()). |
273 StopObservingMediaRoutes(string media_source); | 273 StopObservingMediaRoutes(string media_source); |
274 | 274 |
275 // Called when the MediaRouter is ready to get the next batch of messages | 275 // Starts listening for messages from the media sink for the route given by |
276 // associated with |route_id|. | 276 // |route_id|. |
277 // |messages| returned will contain the batch of messages. | 277 // |MediaRouter::OnRouteMessagesReceived| will be invoked when a batch of |
278 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. | 278 // messages arrives, or when there is an error. |
279 // |error| indicates if a permanent error occurred. If true, then subsequent | 279 // |StopListeningForRouteMessages| will stop the Media Router from receiving |
280 // calls will also return with |error| being true. | 280 // further messages for |route_id|. |
281 ListenForRouteMessages(string route_id) => | 281 StartListeningForRouteMessages(string route_id); |
282 (array<RouteMessage> messages, bool error); | |
283 | 282 |
284 // Called when there are no more listeners for messages for |route_id|. | 283 // Called when there are no more listeners for messages for |route_id|. |
285 // Calling this will resolve the pending |ListenForRouteMessages| callback | |
286 // with an empty list. | |
287 StopListeningForRouteMessages(string route_id); | 284 StopListeningForRouteMessages(string route_id); |
288 | 285 |
289 // Indicates that a PresentationConnection that was connected to route | 286 // Indicates that a PresentationConnection that was connected to route |
290 // |route_id| has been closed (via .close(), garbage collection or | 287 // |route_id| has been closed (via .close(), garbage collection or |
291 // navigation). | 288 // navigation). |
292 DetachRoute(string route_id); | 289 DetachRoute(string route_id); |
293 | 290 |
294 // Enables mDNS discovery. No-op if mDNS discovery is already enabled. | 291 // Enables mDNS discovery. No-op if mDNS discovery is already enabled. |
295 // Calling this will trigger a firewall prompt on Windows if there is not | 292 // Calling this will trigger a firewall prompt on Windows if there is not |
296 // already a firewall rule for mDNS. | 293 // already a firewall rule for mDNS. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 364 |
368 // Called when the state of presentation connected to route |route_id| has | 365 // Called when the state of presentation connected to route |route_id| has |
369 // changed to |state|. | 366 // changed to |state|. |
370 OnPresentationConnectionStateChanged( | 367 OnPresentationConnectionStateChanged( |
371 string route_id, PresentationConnectionState state); | 368 string route_id, PresentationConnectionState state); |
372 | 369 |
373 // Called when the presentation connected to route |route_id| has closed. | 370 // Called when the presentation connected to route |route_id| has closed. |
374 OnPresentationConnectionClosed( | 371 OnPresentationConnectionClosed( |
375 string route_id, PresentationConnectionCloseReason reason, | 372 string route_id, PresentationConnectionCloseReason reason, |
376 string message); | 373 string message); |
| 374 |
| 375 // Called when the a batch of messages arrives from the media sink for the |
| 376 // route given by |route_id|. |
| 377 // |StartListeningForRouteMessages| must be called first in order to receive |
| 378 // messages. |
| 379 // |route_id|: ID of route of the messages. |
| 380 // |messages|: A non-empty list of messages received. |
| 381 OnRouteMessagesReceived(string route_id, |
| 382 array<RouteMessage> messages); |
377 }; | 383 }; |
378 | 384 |
OLD | NEW |