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.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 // Joins an established route given by |route_id| with | |
| 147 // |media_source|. | |
| 148 // |origin| and |tab_id| are used for validating same-origin/tab scopes. | |
| 149 // (See CreateRoute for additional documentation) | |
| 150 // If the operation was successful, |route| will be defined and | |
| 151 // |error_text| will be null. | |
| 152 // If the operation failed, |route| will be null and |error_text| | |
| 153 // will be set. | |
| 154 ConnectRouteByRouteId(string media_source, | |
| 155 string route_id, | |
| 156 string presentation_id, | |
|
mark a. foltz
2015/12/16 07:17:34
Why does the mojo interface take a presentation id
matt.boetger
2015/12/18 23:37:15
It's the same reason CreateRoute is creating a pre
| |
| 157 string origin, | |
| 158 int32 tab_id) => | |
| 159 (MediaRoute? route, string? error_text); | |
| 160 | |
| 146 // Closes the route specified by |route_id|. | 161 // Closes the route specified by |route_id|. |
| 147 CloseRoute(string route_id); | 162 CloseRoute(string route_id); |
| 148 | 163 |
| 149 // Sends |message| via the media route |media_route_id|. | 164 // Sends |message| via the media route |media_route_id|. |
| 150 // If the operation was successful, |sent| is true; otherwise it is false. | 165 // If the operation was successful, |sent| is true; otherwise it is false. |
| 151 SendRouteMessage(string media_route_id, string message) => (bool sent); | 166 SendRouteMessage(string media_route_id, string message) => (bool sent); |
| 152 | 167 |
| 153 // Sends |data| via the media route |media_route_id|. | 168 // Sends |data| via the media route |media_route_id|. |
| 154 // If the operation was successful, |sent| is true; otherwise it is false. | 169 // If the operation was successful, |sent| is true; otherwise it is false. |
| 155 SendRouteBinaryMessage(string media_route_id, array<uint8> data) | 170 SendRouteBinaryMessage(string media_route_id, array<uint8> data) |
| 156 => (bool sent); | 171 => (bool sent); |
| 157 | 172 |
| 158 // Starts querying for sinks capable of displaying |media_source|. | 173 // Starts querying for sinks capable of displaying |media_source|. |
| 159 StartObservingMediaSinks(string media_source); | 174 StartObservingMediaSinks(string media_source); |
| 160 | 175 |
| 161 // Stops querying sinks for |media_source|. | 176 // Stops querying sinks for |media_source|. |
| 162 StopObservingMediaSinks(string media_source); | 177 StopObservingMediaSinks(string media_source); |
| 163 | 178 |
| 164 // Starts reporting the state of active media routes via | 179 // Starts reporting the state of active media routes via |
| 165 // OnRoutesUpdated(). Querying will continue until | 180 // OnRoutesUpdated() in the context of the |media_source|. |
| 166 // StopObservingMediaRoutes() is called. | 181 // The |media_source| should be considered when returning joinable |
|
mark a. foltz
2015/12/16 07:17:34
What is the meaning of an empty media_source?
imcheng
2015/12/17 02:30:57
+1. It would be good to document what is the purpo
matt.boetger
2015/12/18 23:37:14
Added an explanation in the comments.
Done.
matt.boetger
2015/12/18 23:37:14
Done.
| |
| 167 StartObservingMediaRoutes(); | 182 // routes in the OnRoutesUpdated() call. |
| 183 // Querying will continue until StopObservingMediaRoutes is called with the | |
| 184 // same |media_source| (even if it's empty). | |
| 185 StartObservingMediaRoutes(string? media_source); | |
| 168 | 186 |
| 169 // Stops querying the state of all media routes. | 187 // Stops querying the state of all media routes in the context of |
| 170 StopObservingMediaRoutes(); | 188 // the |media_source|. StartObservingMediaRoutes has to be called |
| 189 // with the same |media_source| for this to have any effect. | |
| 190 // Calling StopObservingMediaRoutes without a media_source will stop | |
| 191 // any media routes queries associated with emtpy strings. | |
| 192 StopObservingMediaRoutes(string? media_source); | |
| 171 | 193 |
| 172 // Called when the MediaRouter is ready to get the next batch of messages | 194 // Called when the MediaRouter is ready to get the next batch of messages |
| 173 // associated with |route_id|. | 195 // associated with |route_id|. |
| 174 // |messages| returned will contain the batch of messages. | 196 // |messages| returned will contain the batch of messages. |
| 175 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. | 197 // |messages| will be empty if |StopListeningForRouteMessages| was invoked. |
| 176 // |error| indicates if a permanent error occurred. If true, then subsequent | 198 // |error| indicates if a permanent error occurred. If true, then subsequent |
| 177 // calls will also return with |error| being true. | 199 // calls will also return with |error| being true. |
| 178 ListenForRouteMessages(string route_id) => | 200 ListenForRouteMessages(string route_id) => |
| 179 (array<RouteMessage> messages, bool error); | 201 (array<RouteMessage> messages, bool error); |
| 180 | 202 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 // process. | 237 // process. |
| 216 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => | 238 RegisterMediaRouteProvider(MediaRouteProvider media_router_provider) => |
| 217 (string instance_id); | 239 (string instance_id); |
| 218 | 240 |
| 219 // Called when the Media Route Manager receives a new list of sinks. | 241 // Called when the Media Route Manager receives a new list of sinks. |
| 220 OnSinksReceived(string media_source, array<MediaSink> sinks); | 242 OnSinksReceived(string media_source, array<MediaSink> sinks); |
| 221 | 243 |
| 222 // Called when issues are reported for media routes. | 244 // Called when issues are reported for media routes. |
| 223 OnIssue(Issue issue); | 245 OnIssue(Issue issue); |
| 224 | 246 |
| 225 // Called when list of routes has been updated. | 247 // Called when list of routes has been updated in the context of the |
| 226 OnRoutesUpdated(array<MediaRoute> routes); | 248 // calling |media_source|. The array |joinable_route_ids| should |
| 249 // contain route IDs of joinable routes found in the |routes| array. | |
| 250 OnRoutesUpdated(string media_source, array<MediaRoute> routes, | |
| 251 array<string> joinable_route_ids); | |
| 227 | 252 |
| 228 // Called when the overall availability of media sinks has been updated. | 253 // Called when the overall availability of media sinks has been updated. |
| 229 OnSinkAvailabilityUpdated(SinkAvailability availability); | 254 OnSinkAvailabilityUpdated(SinkAvailability availability); |
| 230 | 255 |
| 231 // Called when the state of presentation connected to route |route_id| has | 256 // Called when the state of presentation connected to route |route_id| has |
| 232 // changed to |state|. | 257 // changed to |state|. |
| 233 OnPresentationConnectionStateChanged( | 258 OnPresentationConnectionStateChanged( |
| 234 string route_id, PresentationConnectionState state); | 259 string route_id, PresentationConnectionState state); |
| 235 }; | 260 }; |
| 236 | 261 |
| OLD | NEW |