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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 BINARY | 107 BINARY |
| 108 }; | 108 }; |
| 109 // The type of this message. | 109 // The type of this message. |
| 110 Type type; | 110 Type type; |
| 111 // Used when the |type| is TEXT. | 111 // Used when the |type| is TEXT. |
| 112 string? message; | 112 string? message; |
| 113 // Used when the |type| is BINARY. | 113 // Used when the |type| is BINARY. |
| 114 array<uint8>? data; | 114 array<uint8>? data; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 struct SinkSearchCriteria { | |
| 118 // Arbitrary string input to the search method. | |
| 119 string input; | |
| 120 // The user's current account domain. | |
|
amp
2016/04/06 21:29:36
call this 'hosted domain' in the comments to line
btolsch
2016/04/08 09:31:24
Done.
| |
| 121 string domain; | |
| 122 }; | |
| 123 | |
| 117 // Maps to a ResultCode value in route_request_result.h | 124 // Maps to a ResultCode value in route_request_result.h |
| 118 // The enum defined here is a subset of those defined in route_request_result.h. | 125 // The enum defined here is a subset of those defined in route_request_result.h. |
| 119 enum RouteRequestResultCode { | 126 enum RouteRequestResultCode { |
| 120 UNKNOWN_ERROR, | 127 UNKNOWN_ERROR, |
| 121 OK, | 128 OK, |
| 122 TIMED_OUT | 129 TIMED_OUT |
| 123 }; | 130 }; |
| 124 | 131 |
| 125 // Modeled after the MediaRouter interface defined in | 132 // Modeled after the MediaRouter interface defined in |
| 126 // chrome/browser/media/router/media_router.h | 133 // chrome/browser/media/router/media_router.h |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 | 286 |
| 280 // Indicates that a PresentationConnection that was connected to route | 287 // Indicates that a PresentationConnection that was connected to route |
| 281 // |route_id| has been closed (via .close(), garbage collection or | 288 // |route_id| has been closed (via .close(), garbage collection or |
| 282 // navigation). | 289 // navigation). |
| 283 DetachRoute(string route_id); | 290 DetachRoute(string route_id); |
| 284 | 291 |
| 285 // Enables mDNS discovery. No-op if mDNS discovery is already enabled. | 292 // Enables mDNS discovery. No-op if mDNS discovery is already enabled. |
| 286 // Calling this will trigger a firewall prompt on Windows if there is not | 293 // Calling this will trigger a firewall prompt on Windows if there is not |
| 287 // already a firewall rule for mDNS. | 294 // already a firewall rule for mDNS. |
| 288 EnableMdnsDiscovery(); | 295 EnableMdnsDiscovery(); |
| 296 | |
| 297 // Indicates that the Media Router is interested in finding a sink that | |
| 298 // matches |search_criteria| and is compatible with the source urn | |
| 299 // |media_source|. The user's current domain is also used to search. If a sink | |
| 300 // is found, a route is also created from |media_source| to the new sink. The | |
| 301 // parameters beyond |search_criteria| will be forwarded to CreateRoute if a | |
| 302 // sink is found. | |
| 303 SearchSinksAndCreateRoute(string sink_id, | |
| 304 string media_source, | |
| 305 SinkSearchCriteria search_criteria, | |
| 306 string presentation_id, | |
| 307 string origin, | |
| 308 int32 tab_id, | |
| 309 int64 timeout_millis, | |
| 310 bool off_the_record) => | |
| 311 (MediaRoute? route, | |
| 312 string? error_text, | |
| 313 RouteRequestResultCode result_code); | |
| 289 }; | 314 }; |
| 290 | 315 |
| 291 // Interface for a service which observes state changes across media | 316 // Interface for a service which observes state changes across media |
| 292 // sources, sinks, and issues. | 317 // sources, sinks, and issues. |
| 293 interface MediaRouter { | 318 interface MediaRouter { |
| 294 | 319 |
| 295 // Represents overall media sink availability states. | 320 // Represents overall media sink availability states. |
| 296 // UNAVAILABLE - No sinks are available. | 321 // UNAVAILABLE - No sinks are available. |
| 297 // PER_SOURCE - Sinks are available, but are only compatible with specific | 322 // PER_SOURCE - Sinks are available, but are only compatible with specific |
| 298 // media sources. | 323 // media sources. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 323 // process. | 348 // process. |
| 324 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => | 349 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => |
| 325 (string instance_id); | 350 (string instance_id); |
| 326 | 351 |
| 327 // Called when the Media Route Manager receives a new list of |sinks| | 352 // Called when the Media Route Manager receives a new list of |sinks| |
| 328 // compatible with |media_source|. The result is only valid for |origins|. If | 353 // compatible with |media_source|. The result is only valid for |origins|. If |
| 329 // |origins| is empty, the result is valid for any origin. | 354 // |origins| is empty, the result is valid for any origin. |
| 330 OnSinksReceived(string media_source, array<MediaSink> sinks, | 355 OnSinksReceived(string media_source, array<MediaSink> sinks, |
| 331 array<string> origins); | 356 array<string> origins); |
| 332 | 357 |
| 358 // Called when the Media Route Manager has found a sink for a current search | |
| 359 // to inform the MR and UI of the ID of the new sink. The sink object itself | |
| 360 // will be returned in the next OnSinksReceived() as part of the normal sink | |
| 361 // list update process. |pseudo_sink_id| identifies the current search. | |
| 362 OnSearchSinkIdReceived(string pseudo_sink_id, string sink_id); | |
| 363 | |
| 333 // Called when issues are reported for media routes. | 364 // Called when issues are reported for media routes. |
| 334 OnIssue(Issue issue); | 365 OnIssue(Issue issue); |
| 335 | 366 |
| 336 // Called when list of routes has been updated in the context of the | 367 // Called when list of routes has been updated in the context of the |
| 337 // calling |media_source|. The array |joinable_route_ids| should | 368 // calling |media_source|. The array |joinable_route_ids| should |
| 338 // contain route IDs of joinable routes found in the |routes| array. | 369 // contain route IDs of joinable routes found in the |routes| array. |
| 339 OnRoutesUpdated(array<MediaRoute> routes, string media_source, | 370 OnRoutesUpdated(array<MediaRoute> routes, string media_source, |
| 340 array<string> joinable_route_ids); | 371 array<string> joinable_route_ids); |
| 341 | 372 |
| 342 // Called when the overall availability of media sinks has been updated. | 373 // Called when the overall availability of media sinks has been updated. |
| 343 OnSinkAvailabilityUpdated(SinkAvailability availability); | 374 OnSinkAvailabilityUpdated(SinkAvailability availability); |
| 344 | 375 |
| 345 // Called when the state of presentation connected to route |route_id| has | 376 // Called when the state of presentation connected to route |route_id| has |
| 346 // changed to |state|. | 377 // changed to |state|. |
| 347 OnPresentationConnectionStateChanged( | 378 OnPresentationConnectionStateChanged( |
| 348 string route_id, PresentationConnectionState state); | 379 string route_id, PresentationConnectionState state); |
| 349 | 380 |
| 350 // Called when the presentation connected to route |route_id| has closed. | 381 // Called when the presentation connected to route |route_id| has closed. |
| 351 OnPresentationConnectionClosed( | 382 OnPresentationConnectionClosed( |
| 352 string route_id, PresentationConnectionCloseReason reason, | 383 string route_id, PresentationConnectionCloseReason reason, |
| 353 string message); | 384 string message); |
| 354 }; | 385 }; |
| 355 | 386 |
| OLD | NEW |