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 |
| 138 // New values must be added here. |
132 }; | 139 }; |
133 | 140 |
134 // Modeled after the MediaRouter interface defined in | 141 // Modeled after the MediaRouter interface defined in |
135 // chrome/browser/media/router/media_router.h | 142 // chrome/browser/media/router/media_router.h |
136 interface MediaRouteProvider { | 143 interface MediaRouteProvider { |
137 // Creates a media route from |media_source| to the sink given by |sink_id|. | 144 // Creates a media route from |media_source| to the sink given by |sink_id|. |
138 // | 145 // |
139 // The presentation ID of the route created will be |presentation_id|, but it | 146 // 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 | 147 // may be overridden by a provider implementation. The presentation ID will |
141 // be used by the presentation API to refer to the created route. | 148 // 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, | 229 string route_id, |
223 string presentation_id, | 230 string presentation_id, |
224 string origin, | 231 string origin, |
225 int32 tab_id, | 232 int32 tab_id, |
226 int64 timeout_millis, | 233 int64 timeout_millis, |
227 bool off_the_record) => | 234 bool off_the_record) => |
228 (MediaRoute? route, | 235 (MediaRoute? route, |
229 string? error_text, | 236 string? error_text, |
230 RouteRequestResultCode result_code); | 237 RouteRequestResultCode result_code); |
231 | 238 |
232 // Terminates the route specified by |route_id|. | 239 // Terminates the route specified by |route_id|. If the route was terminated |
233 TerminateRoute(string route_id); | 240 // successfully, |result_code| is set to OK and |error_text| is null. |
| 241 // Otherwise, |result_code| is an error code and |error_text| describes the |
| 242 // error. |
| 243 TerminateRoute(string route_id) => |
| 244 (string? error_text, RouteRequestResultCode result_code); |
234 | 245 |
235 // Sends |message| via the media route |media_route_id|. | 246 // Sends |message| via the media route |media_route_id|. |
236 // If the operation was successful, |sent| is true; otherwise it is false. | 247 // If the operation was successful, |sent| is true; otherwise it is false. |
237 SendRouteMessage(string media_route_id, string message) => (bool sent); | 248 SendRouteMessage(string media_route_id, string message) => (bool sent); |
238 | 249 |
239 // Sends |data| via the media route |media_route_id|. | 250 // Sends |data| via the media route |media_route_id|. |
240 // If the operation was successful, |sent| is true; otherwise it is false. | 251 // If the operation was successful, |sent| is true; otherwise it is false. |
241 SendRouteBinaryMessage(string media_route_id, array<uint8> data) | 252 SendRouteBinaryMessage(string media_route_id, array<uint8> data) |
242 => (bool sent); | 253 => (bool sent); |
243 | 254 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // Called when the a batch of messages arrives from the media sink for the | 386 // Called when the a batch of messages arrives from the media sink for the |
376 // route given by |route_id|. | 387 // route given by |route_id|. |
377 // |StartListeningForRouteMessages| must be called first in order to receive | 388 // |StartListeningForRouteMessages| must be called first in order to receive |
378 // messages. | 389 // messages. |
379 // |route_id|: ID of route of the messages. | 390 // |route_id|: ID of route of the messages. |
380 // |messages|: A non-empty list of messages received. | 391 // |messages|: A non-empty list of messages received. |
381 OnRouteMessagesReceived(string route_id, | 392 OnRouteMessagesReceived(string route_id, |
382 array<RouteMessage> messages); | 393 array<RouteMessage> messages); |
383 }; | 394 }; |
384 | 395 |
OLD | NEW |