| 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 // Input to the search method which each Media Route Provider may interpret |
| 119 // differently. |
| 120 string input; |
| 121 // The user's current hosted domain. |
| 122 string domain; |
| 123 }; |
| 124 |
| 117 // Maps to a ResultCode value in route_request_result.h | 125 // 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. | 126 // The enum defined here is a subset of those defined in route_request_result.h. |
| 119 enum RouteRequestResultCode { | 127 enum RouteRequestResultCode { |
| 120 UNKNOWN_ERROR, | 128 UNKNOWN_ERROR, |
| 121 OK, | 129 OK, |
| 122 TIMED_OUT | 130 TIMED_OUT |
| 123 }; | 131 }; |
| 124 | 132 |
| 125 // Modeled after the MediaRouter interface defined in | 133 // Modeled after the MediaRouter interface defined in |
| 126 // chrome/browser/media/router/media_router.h | 134 // chrome/browser/media/router/media_router.h |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 string origin, | 189 string origin, |
| 182 int32 tab_id, | 190 int32 tab_id, |
| 183 int64 timeout_millis, | 191 int64 timeout_millis, |
| 184 bool off_the_record) => | 192 bool off_the_record) => |
| 185 (MediaRoute? route, | 193 (MediaRoute? route, |
| 186 string? error_text, | 194 string? error_text, |
| 187 RouteRequestResultCode result_code); | 195 RouteRequestResultCode result_code); |
| 188 | 196 |
| 189 // Creates a new route for |media_source| that connects to the established | 197 // Creates a new route for |media_source| that connects to the established |
| 190 // route given by |route_id|. | 198 // route given by |route_id|. |
| 191 // | 199 // |
| 192 // The presentation ID of the new route will be |presentation_id|, but it may | 200 // The presentation ID of the new route will be |presentation_id|, but it may |
| 193 // be overridden by a provider implementation. The presentation ID will be | 201 // be overridden by a provider implementation. The presentation ID will be |
| 194 // used by the presentation API to refer to the created route. | 202 // used by the presentation API to refer to the created route. |
| 195 // | 203 // |
| 196 // |origin| and |tab_id| are used for validating same-origin/tab scopes; see | 204 // |origin| and |tab_id| are used for validating same-origin/tab scopes; see |
| 197 // CreateRoute for additional documentation. | 205 // CreateRoute for additional documentation. |
| 198 // | 206 // |
| 199 // If |timeout_millis| is positive, it will be used in place of the default | 207 // If |timeout_millis| is positive, it will be used in place of the default |
| 200 // timeout defined by Media Route Provider Manager; see CreateRoute for additi
onal | 208 // timeout defined by Media Route Provider Manager; see CreateRoute for additi
onal |
| 201 // documentation. | 209 // documentation. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // navigation). | 290 // navigation). |
| 283 DetachRoute(string route_id); | 291 DetachRoute(string route_id); |
| 284 | 292 |
| 285 // Enables mDNS discovery. No-op if mDNS discovery is already enabled. | 293 // 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 | 294 // Calling this will trigger a firewall prompt on Windows if there is not |
| 287 // already a firewall rule for mDNS. | 295 // already a firewall rule for mDNS. |
| 288 EnableMdnsDiscovery(); | 296 EnableMdnsDiscovery(); |
| 289 | 297 |
| 290 // Updates media sinks capable of displaying |media_source|. | 298 // Updates media sinks capable of displaying |media_source|. |
| 291 UpdateMediaSinks(string media_source); | 299 UpdateMediaSinks(string media_source); |
| 300 |
| 301 // Indicates that the Media Router is interested in finding a sink that |
| 302 // matches |search_criteria| and is compatible with the source urn |
| 303 // |media_source|. The user's current domain is also used to search. If a sink |
| 304 // is found, a route is also created from |media_source| to the new sink. The |
| 305 // parameters beyond |search_criteria| will be forwarded to CreateRoute if a |
| 306 // sink is found. |
| 307 SearchSinksAndCreateRoute(string sink_id, |
| 308 string media_source, |
| 309 SinkSearchCriteria search_criteria, |
| 310 string presentation_id, |
| 311 string origin, |
| 312 int32 tab_id, |
| 313 int64 timeout_millis, |
| 314 bool off_the_record) => |
| 315 (MediaRoute? route, |
| 316 string? error_text, |
| 317 RouteRequestResultCode result_code); |
| 292 }; | 318 }; |
| 293 | 319 |
| 294 // Interface for a service which observes state changes across media | 320 // Interface for a service which observes state changes across media |
| 295 // sources, sinks, and issues. | 321 // sources, sinks, and issues. |
| 296 interface MediaRouter { | 322 interface MediaRouter { |
| 297 | 323 |
| 298 // Represents overall media sink availability states. | 324 // Represents overall media sink availability states. |
| 299 // UNAVAILABLE - No sinks are available. | 325 // UNAVAILABLE - No sinks are available. |
| 300 // PER_SOURCE - Sinks are available, but are only compatible with specific | 326 // PER_SOURCE - Sinks are available, but are only compatible with specific |
| 301 // media sources. | 327 // media sources. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 326 // process. | 352 // process. |
| 327 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => | 353 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => |
| 328 (string instance_id); | 354 (string instance_id); |
| 329 | 355 |
| 330 // Called when the Media Route Manager receives a new list of |sinks| | 356 // Called when the Media Route Manager receives a new list of |sinks| |
| 331 // compatible with |media_source|. The result is only valid for |origins|. If | 357 // compatible with |media_source|. The result is only valid for |origins|. If |
| 332 // |origins| is empty, the result is valid for any origin. | 358 // |origins| is empty, the result is valid for any origin. |
| 333 OnSinksReceived(string media_source, array<MediaSink> sinks, | 359 OnSinksReceived(string media_source, array<MediaSink> sinks, |
| 334 array<string> origins); | 360 array<string> origins); |
| 335 | 361 |
| 362 // Called when the Media Route Manager has found a sink for a current search |
| 363 // to inform the MR and UI of the ID of the new sink. The sink object itself |
| 364 // will be returned in the next OnSinksReceived() as part of the normal sink |
| 365 // list update process. |pseudo_sink_id| identifies the current search. |
| 366 OnSearchSinkIdReceived(string pseudo_sink_id, string sink_id); |
| 367 |
| 336 // Called when issues are reported for media routes. | 368 // Called when issues are reported for media routes. |
| 337 OnIssue(Issue issue); | 369 OnIssue(Issue issue); |
| 338 | 370 |
| 339 // Called when list of routes has been updated in the context of the | 371 // Called when list of routes has been updated in the context of the |
| 340 // calling |media_source|. The array |joinable_route_ids| should | 372 // calling |media_source|. The array |joinable_route_ids| should |
| 341 // contain route IDs of joinable routes found in the |routes| array. | 373 // contain route IDs of joinable routes found in the |routes| array. |
| 342 OnRoutesUpdated(array<MediaRoute> routes, string media_source, | 374 OnRoutesUpdated(array<MediaRoute> routes, string media_source, |
| 343 array<string> joinable_route_ids); | 375 array<string> joinable_route_ids); |
| 344 | 376 |
| 345 // Called when the overall availability of media sinks has been updated. | 377 // Called when the overall availability of media sinks has been updated. |
| 346 OnSinkAvailabilityUpdated(SinkAvailability availability); | 378 OnSinkAvailabilityUpdated(SinkAvailability availability); |
| 347 | 379 |
| 348 // Called when the state of presentation connected to route |route_id| has | 380 // Called when the state of presentation connected to route |route_id| has |
| 349 // changed to |state|. | 381 // changed to |state|. |
| 350 OnPresentationConnectionStateChanged( | 382 OnPresentationConnectionStateChanged( |
| 351 string route_id, PresentationConnectionState state); | 383 string route_id, PresentationConnectionState state); |
| 352 | 384 |
| 353 // Called when the presentation connected to route |route_id| has closed. | 385 // Called when the presentation connected to route |route_id| has closed. |
| 354 OnPresentationConnectionClosed( | 386 OnPresentationConnectionClosed( |
| 355 string route_id, PresentationConnectionCloseReason reason, | 387 string route_id, PresentationConnectionCloseReason reason, |
| 356 string message); | 388 string message); |
| 357 }; | 389 }; |
| 358 | 390 |
| OLD | NEW |