| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // (See CreateRoute for additional documentation) | 136 // (See CreateRoute for additional documentation) |
| 137 // If the operation was successful, |route| will be defined and | 137 // If the operation was successful, |route| will be defined and |
| 138 // |error_text| will be null. | 138 // |error_text| will be null. |
| 139 // If the operation failed, |route| will be null and |error_text| | 139 // If the operation failed, |route| will be null and |error_text| |
| 140 // will be set. | 140 // will be set. |
| 141 JoinRoute(string media_source, | 141 JoinRoute(string media_source, |
| 142 string presentation_id, | 142 string presentation_id, |
| 143 string origin, | 143 string origin, |
| 144 int32 tab_id) => (MediaRoute? route, string? error_text); | 144 int32 tab_id) => (MediaRoute? route, string? error_text); |
| 145 | 145 |
| 146 // Connects an established route given by |route_id| with |
| 147 // |media_source|. The presentation ID of the route created will be |
| 148 // |presentation_id|, but it may be overridden by a provider implementation. |
| 149 // The presentation ID will be used by the presentation API to refer to the |
| 150 // created route. |origin| and |tab_id| are used for validating |
| 151 // same-origin/tab scopes. |
| 152 // (See CreateRoute for additional documentation) |
| 153 // If the operation was successful, |route| will be defined and |
| 154 // |error_text| will be null. If the operation failed, |route| will be null |
| 155 // and |error_text| will be set. |
| 156 ConnectRouteByRouteId(string media_source, |
| 157 string route_id, |
| 158 string presentation_id, |
| 159 string origin, |
| 160 int32 tab_id) => |
| 161 (MediaRoute? route, string? error_text); |
| 162 |
| 146 // Terminates the route specified by |route_id|. | 163 // Terminates the route specified by |route_id|. |
| 147 TerminateRoute(string route_id); | 164 TerminateRoute(string route_id); |
| 148 | 165 |
| 149 // Sends |message| via the media route |media_route_id|. | 166 // Sends |message| via the media route |media_route_id|. |
| 150 // If the operation was successful, |sent| is true; otherwise it is false. | 167 // If the operation was successful, |sent| is true; otherwise it is false. |
| 151 SendRouteMessage(string media_route_id, string message) => (bool sent); | 168 SendRouteMessage(string media_route_id, string message) => (bool sent); |
| 152 | 169 |
| 153 // Sends |data| via the media route |media_route_id|. | 170 // Sends |data| via the media route |media_route_id|. |
| 154 // If the operation was successful, |sent| is true; otherwise it is false. | 171 // If the operation was successful, |sent| is true; otherwise it is false. |
| 155 SendRouteBinaryMessage(string media_route_id, array<uint8> data) | 172 SendRouteBinaryMessage(string media_route_id, array<uint8> data) |
| 156 => (bool sent); | 173 => (bool sent); |
| 157 | 174 |
| 158 // Starts querying for sinks capable of displaying |media_source|. | 175 // Starts querying for sinks capable of displaying |media_source|. |
| 159 StartObservingMediaSinks(string media_source); | 176 StartObservingMediaSinks(string media_source); |
| 160 | 177 |
| 161 // Stops querying sinks for |media_source|. | 178 // Stops querying sinks for |media_source|. |
| 162 StopObservingMediaSinks(string media_source); | 179 StopObservingMediaSinks(string media_source); |
| 163 | 180 |
| 164 // Starts reporting the state of active media routes via | 181 // Starts reporting the state of active media routes via |
| 165 // OnRoutesUpdated(). Querying will continue until | 182 // OnRoutesUpdated() in the context of the |media_source|. The |
| 166 // StopObservingMediaRoutes() is called. | 183 // |media_source| represents the application interested in the media |
| 167 StartObservingMediaRoutes(); | 184 // routes (usually the web page from which the content originates). |
| 185 // If no |media_source| is given, this should be considered an |
| 186 // observer that is not associated with a media source, and thus |
| 187 // cannot connect to a remote route without showing a source. The |
| 188 // |media_source| should be considered when returning joinable routes in the |
| 189 // OnRoutesUpdated() call. If an empty |media_source| is given, there is no |
| 190 // context in which a joinable route makes sense and therefore, there should |
| 191 // not be any joinable routes returned in OnRoutesUpdated(). |
| 192 // Querying will continue until StopObservingMediaRoutes() is called with |
| 193 // the same |media_source| (even if it's an empty string). |
| 194 StartObservingMediaRoutes(string media_source); |
| 168 | 195 |
| 169 // Stops querying the state of all media routes. | 196 // Stops querying the state of all media routes in the context of |
| 170 StopObservingMediaRoutes(); | 197 // the |media_source|. StartObservingMediaRoutes() has |
| 198 // to be called with the same |media_source| for this to have any effect even |
| 199 // if it's empty. Thus, StartObservingMediaRoutes(media_source) must be |
| 200 // matched with StopObservingMediaRoutes(media_source). |
| 201 // Calling StopObservingMediaRoutes() without a media_source will stop |
| 202 // any media routes queries associated with emtpy strings (queries |
| 203 // that being with StartObservingMediaRoutes()). |
| 204 StopObservingMediaRoutes(string media_source); |
| 171 | 205 |
| 172 // Called when the MediaRouter is ready to get the next batch of messages | 206 // Called when the MediaRouter is ready to get the next batch of messages |
| 173 // associated with |route_id|. | 207 // associated with |route_id|. |
| 174 // |messages| returned will contain the batch of messages. | 208 // |messages| returned will contain the batch of messages. |
| 175 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. | 209 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. |
| 176 // |error| indicates if a permanent error occurred. If true, then subsequent | 210 // |error| indicates if a permanent error occurred. If true, then subsequent |
| 177 // calls will also return with |error| being true. | 211 // calls will also return with |error| being true. |
| 178 ListenForRouteMessages(string route_id) => | 212 ListenForRouteMessages(string route_id) => |
| 179 (array<RouteMessage> messages, bool error); | 213 (array<RouteMessage> messages, bool error); |
| 180 | 214 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // process. | 250 // process. |
| 217 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => | 251 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => |
| 218 (string instance_id); | 252 (string instance_id); |
| 219 | 253 |
| 220 // Called when the Media Route Manager receives a new list of sinks. | 254 // Called when the Media Route Manager receives a new list of sinks. |
| 221 OnSinksReceived(string media_source, array<MediaSink> sinks); | 255 OnSinksReceived(string media_source, array<MediaSink> sinks); |
| 222 | 256 |
| 223 // Called when issues are reported for media routes. | 257 // Called when issues are reported for media routes. |
| 224 OnIssue(Issue issue); | 258 OnIssue(Issue issue); |
| 225 | 259 |
| 226 // Called when list of routes has been updated. | 260 // Called when list of routes has been updated in the context of the |
| 227 OnRoutesUpdated(array<MediaRoute> routes); | 261 // calling |media_source|. The array |joinable_route_ids| should |
| 262 // contain route IDs of joinable routes found in the |routes| array. |
| 263 OnRoutesUpdated(array<MediaRoute> routes, string media_source, |
| 264 array<string> joinable_route_ids); |
| 228 | 265 |
| 229 // Called when the overall availability of media sinks has been updated. | 266 // Called when the overall availability of media sinks has been updated. |
| 230 OnSinkAvailabilityUpdated(SinkAvailability availability); | 267 OnSinkAvailabilityUpdated(SinkAvailability availability); |
| 231 | 268 |
| 232 // Called when the state of presentation connected to route |route_id| has | 269 // Called when the state of presentation connected to route |route_id| has |
| 233 // changed to |state|. | 270 // changed to |state|. |
| 234 OnPresentationConnectionStateChanged( | 271 OnPresentationConnectionStateChanged( |
| 235 string route_id, PresentationConnectionState state); | 272 string route_id, PresentationConnectionState state); |
| 236 }; | 273 }; |
| 237 | 274 |
| OLD | NEW |