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.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 | 74 |
| 73 // Should be kept in sync with media_route.h. | 75 // Should be kept in sync with media_route.h. |
| 74 struct MediaRoute { | 76 struct MediaRoute { |
| 75 // The ID of this media route, e.g. "r_PR1O_blkC9dsKp-tb1ti8qurOo". | 77 // The ID of this media route, e.g. "r_PR1O_blkC9dsKp-tb1ti8qurOo". |
| 76 string media_route_id; | 78 string media_route_id; |
| 77 // The ID of the media source being sent through this media route. | 79 // The ID of the media source being sent through this media route. |
| 78 // May be missing if route is not local. | 80 // May be missing if route is not local. |
| 79 string? media_source; | 81 string? media_source; |
| 80 // The ID of sink that is rendering the media content. | 82 // The ID of sink that is rendering the media content. |
| 81 string media_sink_id; | 83 string media_sink_id; |
| 82 // Human readable description of this route, e.g. | 84 // Human readable description of this route, e.g. "Tab casting". |
| 83 // "Tab casting". | |
| 84 string description; | 85 string description; |
| 85 // Specifies that the route is requested locally. | 86 // Specifies that the route is requested locally. |
| 86 bool is_local; | 87 bool is_local; |
| 87 // An optional path to an HTML page bundled bundled with the media router | 88 // An optional path to an HTML page bundled bundled with the media router |
| 88 // component extension. When set, the route can have custom route detail as | 89 // component extension. When set, the route can have custom route detail as |
| 89 // well as its own route controls in the media router dialog. | 90 // well as its own route controls in the media router dialog. |
| 90 string? custom_controller_path; | 91 string? custom_controller_path; |
| 91 // Set to true if this route should be displayed for |media_sink_id| in UI. | 92 // Set to true if this route should be displayed for |media_sink_id| in UI. |
| 92 bool for_display; | 93 bool for_display; |
| 93 // Set to true if this route was created by an incognito profile. | 94 // Set to true if this route was created by an incognito profile. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 // Indicates that the Media Router is interested in finding a sink that | 357 // Indicates that the Media Router is interested in finding a sink that |
| 357 // matches |search_criteria| and is compatible with the source urn | 358 // matches |search_criteria| and is compatible with the source urn |
| 358 // |media_source|. |search_criteria| should contain an exact copy of the user | 359 // |media_source|. |search_criteria| should contain an exact copy of the user |
| 359 // input. The user's current domain is also used to search. The domain is the | 360 // input. The user's current domain is also used to search. The domain is the |
| 360 // hosted domain of the user's signed-in identity, or empty if the user has no | 361 // hosted domain of the user's signed-in identity, or empty if the user has no |
| 361 // domain or is not signed in. | 362 // domain or is not signed in. |
| 362 SearchSinks(string sink_id, | 363 SearchSinks(string sink_id, |
| 363 string media_source, | 364 string media_source, |
| 364 SinkSearchCriteria search_criteria) => | 365 SinkSearchCriteria search_criteria) => |
| 365 (string sink_id); | 366 (string sink_id); |
| 367 | |
| 368 // Creates a controller for the media route with given |route_id| and binds it | |
| 369 // to |media_controller| for receiving media commands. This method returns | |
| 370 // false if such a media route doesn't exist, a controller already exists | |
| 371 // for it, or there was an error while creating a controller. | |
| 372 // |media_controller| becomes invalid when the media route is terminated. The | |
| 373 // created controller is destroyed when |media_controller| becomes invalid. | |
| 374 // TODO(takumif): Consider returning an enum instead of a bool to distinguish | |
| 375 // between error conditions for metrics/debugging. | |
| 376 CreateMediaRouteController(string route_id, | |
| 377 MediaController& media_controller) => | |
| 378 (bool success); | |
|
dcheng
2017/03/27 22:15:26
Out of curiosity, would it make sense to just have
imcheng
2017/03/28 01:18:38
We still need a way to invalidate the MediaRouteCo
| |
| 379 | |
| 380 // Sets the observer to be notified whenever there is a change in the status | |
| 381 // of a media route. A media route can have at most one observer at a time, | |
| 382 // and it will be overwritten each time this method is called with the same | |
| 383 // |route_id|. | |
| 384 SetMediaRouteStatusObserver(string route_id, MediaStatusObserver observer); | |
| 366 }; | 385 }; |
| 367 | 386 |
| 368 // Interface for a service which observes state changes across media | 387 // Interface for a service which observes state changes across media |
| 369 // sources, sinks, and issues. | 388 // sources, sinks, and issues. |
| 370 interface MediaRouter { | 389 interface MediaRouter { |
| 371 | 390 |
| 372 // Represents overall media sink availability states. | 391 // Represents overall media sink availability states. |
| 373 // UNAVAILABLE - No sinks are available. | 392 // UNAVAILABLE - No sinks are available. |
| 374 // PER_SOURCE - Sinks are available, but are only compatible with specific | 393 // PER_SOURCE - Sinks are available, but are only compatible with specific |
| 375 // media sources. | 394 // media sources. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 | 450 |
| 432 // Called when the a batch of messages arrives from the media sink for the | 451 // Called when the a batch of messages arrives from the media sink for the |
| 433 // route given by |route_id|. | 452 // route given by |route_id|. |
| 434 // |StartListeningForRouteMessages| must be called first in order to receive | 453 // |StartListeningForRouteMessages| must be called first in order to receive |
| 435 // messages. | 454 // messages. |
| 436 // |route_id|: ID of route of the messages. | 455 // |route_id|: ID of route of the messages. |
| 437 // |messages|: A non-empty list of messages received. | 456 // |messages|: A non-empty list of messages received. |
| 438 OnRouteMessagesReceived(string route_id, | 457 OnRouteMessagesReceived(string route_id, |
| 439 array<RouteMessage> messages); | 458 array<RouteMessage> messages); |
| 440 }; | 459 }; |
| OLD | NEW |