| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 struct SinkSearchCriteria { | 117 struct SinkSearchCriteria { |
| 118 // Input to the search method which each Media Route Provider may interpret | 118 // Input to the search method which each Media Route Provider may interpret |
| 119 // differently. | 119 // differently. |
| 120 string input; | 120 string input; |
| 121 // The user's current hosted domain. | 121 // The user's current hosted domain. |
| 122 string domain; | 122 string domain; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // Maps to a ResultCode value in route_request_result.h | 125 // Keep in sync with: |
| 126 // The enum defined here is a subset of those defined in route_request_result.h. | 126 // - RouteRequestResult::ResultCode in route_request_result.h |
| 127 // - MediaRouteProviderResult enum in tools/metrics/histograms.xml. |
| 128 // - mr.RouteRequestResultCode in route_request_error.js |
| 127 enum RouteRequestResultCode { | 129 enum RouteRequestResultCode { |
| 128 UNKNOWN_ERROR, | 130 UNKNOWN_ERROR, |
| 129 OK, | 131 OK, |
| 130 TIMED_OUT, | 132 TIMED_OUT, |
| 131 ROUTE_NOT_FOUND | 133 ROUTE_NOT_FOUND, |
| 134 SINK_NOT_FOUND, |
| 135 INVALID_ORIGIN, |
| 136 OFF_THE_RECORD_MISMATCH, |
| 137 NO_SUPPORTED_PROVIDER |
| 132 }; | 138 }; |
| 133 | 139 |
| 134 // Modeled after the MediaRouter interface defined in | 140 // Modeled after the MediaRouter interface defined in |
| 135 // chrome/browser/media/router/media_router.h | 141 // chrome/browser/media/router/media_router.h |
| 136 interface MediaRouteProvider { | 142 interface MediaRouteProvider { |
| 137 // Creates a media route from |media_source| to the sink given by |sink_id|. | 143 // Creates a media route from |media_source| to the sink given by |sink_id|. |
| 138 // | 144 // |
| 139 // The presentation ID of the route created will be |presentation_id|, but it | 145 // The presentation ID of the route created will be |presentation_id|, but it |
| 140 // may be overridden by a provider implementation. The presentation ID will | 146 // may be overridden by a provider implementation. The presentation ID will |
| 141 // be used by the presentation API to refer to the created route. | 147 // be used by the presentation API to refer to the created route. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 string route_id, | 228 string route_id, |
| 223 string presentation_id, | 229 string presentation_id, |
| 224 string origin, | 230 string origin, |
| 225 int32 tab_id, | 231 int32 tab_id, |
| 226 int64 timeout_millis, | 232 int64 timeout_millis, |
| 227 bool off_the_record) => | 233 bool off_the_record) => |
| 228 (MediaRoute? route, | 234 (MediaRoute? route, |
| 229 string? error_text, | 235 string? error_text, |
| 230 RouteRequestResultCode result_code); | 236 RouteRequestResultCode result_code); |
| 231 | 237 |
| 232 // Terminates the route specified by |route_id|. | 238 // Terminates the route specified by |route_id|. If the route was terminated |
| 233 TerminateRoute(string route_id); | 239 // successfully, |result_code| is set to OK and |error_text| is null. |
| 240 // Otherwise, |result_code| is an error code and |error_text| describes the |
| 241 // error. |
| 242 TerminateRoute(string route_id) => |
| 243 (string? error_text, RouteRequestResultCode result_code); |
| 234 | 244 |
| 235 // Sends |message| via the media route |media_route_id|. | 245 // Sends |message| via the media route |media_route_id|. |
| 236 // If the operation was successful, |sent| is true; otherwise it is false. | 246 // If the operation was successful, |sent| is true; otherwise it is false. |
| 237 SendRouteMessage(string media_route_id, string message) => (bool sent); | 247 SendRouteMessage(string media_route_id, string message) => (bool sent); |
| 238 | 248 |
| 239 // Sends |data| via the media route |media_route_id|. | 249 // Sends |data| via the media route |media_route_id|. |
| 240 // If the operation was successful, |sent| is true; otherwise it is false. | 250 // If the operation was successful, |sent| is true; otherwise it is false. |
| 241 SendRouteBinaryMessage(string media_route_id, array<uint8> data) | 251 SendRouteBinaryMessage(string media_route_id, array<uint8> data) |
| 242 => (bool sent); | 252 => (bool sent); |
| 243 | 253 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // changed to |state|. | 379 // changed to |state|. |
| 370 OnPresentationConnectionStateChanged( | 380 OnPresentationConnectionStateChanged( |
| 371 string route_id, PresentationConnectionState state); | 381 string route_id, PresentationConnectionState state); |
| 372 | 382 |
| 373 // Called when the presentation connected to route |route_id| has closed. | 383 // Called when the presentation connected to route |route_id| has closed. |
| 374 OnPresentationConnectionClosed( | 384 OnPresentationConnectionClosed( |
| 375 string route_id, PresentationConnectionCloseReason reason, | 385 string route_id, PresentationConnectionCloseReason reason, |
| 376 string message); | 386 string message); |
| 377 }; | 387 }; |
| 378 | 388 |
| OLD | NEW |