| 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.mojom; | 5 module media_router.mojom; |
| 6 | 6 |
| 7 import "chrome/browser/media/router/mojo/media_controller.mojom"; |
| 8 import "chrome/browser/media/router/mojo/media_status.mojom"; |
| 7 import "mojo/common/time.mojom"; | 9 import "mojo/common/time.mojom"; |
| 8 import "net/interfaces/ip_address.mojom"; | 10 import "net/interfaces/ip_address.mojom"; |
| 9 import "url/mojo/origin.mojom"; | 11 import "url/mojo/origin.mojom"; |
| 10 import "url/mojo/url.mojom"; | 12 import "url/mojo/url.mojom"; |
| 11 | 13 |
| 12 // Represents an output sink to which media can be routed. | 14 // Represents an output sink to which media can be routed. |
| 13 struct MediaSink { | 15 struct MediaSink { |
| 14 enum IconType { | 16 enum IconType { |
| 15 CAST, | 17 CAST, |
| 16 CAST_AUDIO, | 18 CAST_AUDIO, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 75 |
| 74 // Should be kept in sync with media_route.h. | 76 // Should be kept in sync with media_route.h. |
| 75 struct MediaRoute { | 77 struct MediaRoute { |
| 76 // The ID of this media route, e.g. "r_PR1O_blkC9dsKp-tb1ti8qurOo". | 78 // The ID of this media route, e.g. "r_PR1O_blkC9dsKp-tb1ti8qurOo". |
| 77 string media_route_id; | 79 string media_route_id; |
| 78 // The ID of the media source being sent through this media route. | 80 // The ID of the media source being sent through this media route. |
| 79 // May be missing if route is not local. | 81 // May be missing if route is not local. |
| 80 string? media_source; | 82 string? media_source; |
| 81 // The ID of sink that is rendering the media content. | 83 // The ID of sink that is rendering the media content. |
| 82 string media_sink_id; | 84 string media_sink_id; |
| 83 // Human readable description of this route, e.g. | 85 // Human readable description of this route, e.g. "Tab casting". |
| 84 // "Tab casting". | |
| 85 string description; | 86 string description; |
| 86 // Specifies that the route is requested locally. | 87 // Specifies that the route is requested locally. |
| 87 bool is_local; | 88 bool is_local; |
| 88 // An optional path to an HTML page bundled bundled with the media router | 89 // An optional path to an HTML page bundled bundled with the media router |
| 89 // component extension. When set, the route can have custom route detail as | 90 // component extension. When set, the route can have custom route detail as |
| 90 // well as its own route controls in the media router dialog. | 91 // well as its own route controls in the media router dialog. |
| 91 string? custom_controller_path; | 92 string? custom_controller_path; |
| 92 // Set to true if this route should be displayed for |media_sink_id| in UI. | 93 // Set to true if this route should be displayed for |media_sink_id| in UI. |
| 93 bool for_display; | 94 bool for_display; |
| 94 // Set to true if this route was created by an incognito profile. | 95 // Set to true if this route was created by an incognito profile. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // domain or is not signed in. | 363 // domain or is not signed in. |
| 363 SearchSinks(string sink_id, | 364 SearchSinks(string sink_id, |
| 364 string media_source, | 365 string media_source, |
| 365 SinkSearchCriteria search_criteria) => | 366 SinkSearchCriteria search_criteria) => |
| 366 (string sink_id); | 367 (string sink_id); |
| 367 | 368 |
| 368 // Called when the list of MediaSinks discovered by Media Router has been | 369 // Called when the list of MediaSinks discovered by Media Router has been |
| 369 // updated. The sinks are supplied to the MediaRouteProvider so that they can | 370 // updated. The sinks are supplied to the MediaRouteProvider so that they can |
| 370 // be used for other operations, such as route creation. | 371 // be used for other operations, such as route creation. |
| 371 ProvideSinks(string provider_name, array<MediaSink> sinks); | 372 ProvideSinks(string provider_name, array<MediaSink> sinks); |
| 373 |
| 374 // Creates a controller for the media route with given |route_id| and binds it |
| 375 // to |media_controller| for receiving media commands. This method returns |
| 376 // false if such a media route doesn't exist, a controller already exists |
| 377 // for it, or there was an error while creating a controller. This method must |
| 378 // close |media_controller| in case of such a failure. |media_controller| |
| 379 // becomes invalid when the media route is terminated. The created controller |
| 380 // is destroyed when |media_controller| becomes invalid, after which this |
| 381 // method can be called again with the same |route_id|. |
| 382 // TODO(takumif): Consider returning an enum instead of a bool to distinguish |
| 383 // between error conditions for metrics/debugging. |
| 384 CreateMediaRouteController(string route_id, |
| 385 MediaController& media_controller) => |
| 386 (bool success); |
| 387 |
| 388 // Sets the observer to be notified whenever there is a change in the status |
| 389 // of a media route. A media route can have at most one observer at a time, |
| 390 // and it will be overwritten each time this method is called with the same |
| 391 // |route_id|. |
| 392 SetMediaRouteStatusObserver(string route_id, MediaStatusObserver observer); |
| 372 }; | 393 }; |
| 373 | 394 |
| 374 // Interface for a service which observes state changes across media | 395 // Interface for a service which observes state changes across media |
| 375 // sources, sinks, and issues. | 396 // sources, sinks, and issues. |
| 376 interface MediaRouter { | 397 interface MediaRouter { |
| 377 | 398 |
| 378 // Represents overall media sink availability states. | 399 // Represents overall media sink availability states. |
| 379 // UNAVAILABLE - No sinks are available. | 400 // UNAVAILABLE - No sinks are available. |
| 380 // PER_SOURCE - Sinks are available, but are only compatible with specific | 401 // PER_SOURCE - Sinks are available, but are only compatible with specific |
| 381 // media sources. | 402 // media sources. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 458 |
| 438 // Called when the a batch of messages arrives from the media sink for the | 459 // Called when the a batch of messages arrives from the media sink for the |
| 439 // route given by |route_id|. | 460 // route given by |route_id|. |
| 440 // |StartListeningForRouteMessages| must be called first in order to receive | 461 // |StartListeningForRouteMessages| must be called first in order to receive |
| 441 // messages. | 462 // messages. |
| 442 // |route_id|: ID of route of the messages. | 463 // |route_id|: ID of route of the messages. |
| 443 // |messages|: A non-empty list of messages received. | 464 // |messages|: A non-empty list of messages received. |
| 444 OnRouteMessagesReceived(string route_id, | 465 OnRouteMessagesReceived(string route_id, |
| 445 array<RouteMessage> messages); | 466 array<RouteMessage> messages); |
| 446 }; | 467 }; |
| OLD | NEW |