| 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 28 matching lines...) Expand all Loading... |
| 39 // "Tab casting". | 39 // "Tab casting". |
| 40 string description; | 40 string description; |
| 41 // Specifies that the route is requested locally. | 41 // Specifies that the route is requested locally. |
| 42 bool is_local; | 42 bool is_local; |
| 43 // An optional path to an HTML page bundled bundled with the media router | 43 // An optional path to an HTML page bundled bundled with the media router |
| 44 // component extension. When set, the route can have custom route detail as | 44 // component extension. When set, the route can have custom route detail as |
| 45 // well as its own route controls in the media router dialog. | 45 // well as its own route controls in the media router dialog. |
| 46 string? custom_controller_path; | 46 string? custom_controller_path; |
| 47 // Set to true if this route should be displayed for |media_sink_id| in UI. | 47 // Set to true if this route should be displayed for |media_sink_id| in UI. |
| 48 bool for_display; | 48 bool for_display; |
| 49 // Set to true if this route was created by an off the record (incognito) | 49 // Set to true if this route was created by an incognito profile. |
| 50 // profile. | 50 bool incognito; |
| 51 bool off_the_record; | |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 // Notifications or an actionable events to be shown to the user. | 53 // Notifications or an actionable events to be shown to the user. |
| 55 // When is_blocking is true, media router UI shows issue only: | 54 // When is_blocking is true, media router UI shows issue only: |
| 56 // | 55 // |
| 57 // Title | 56 // Title |
| 58 // Message | 57 // Message |
| 59 // default_action_button secondary_action_button | 58 // default_action_button secondary_action_button |
| 60 // | 59 // |
| 61 // When is_blocking is false, media router UI uses banner: | 60 // When is_blocking is false, media router UI uses banner: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // - RouteRequestResult::ResultCode in route_request_result.h | 125 // - RouteRequestResult::ResultCode in route_request_result.h |
| 127 // - MediaRouteProviderResult enum in tools/metrics/histograms.xml. | 126 // - MediaRouteProviderResult enum in tools/metrics/histograms.xml. |
| 128 // - mr.RouteRequestResultCode in route_request_error.js | 127 // - mr.RouteRequestResultCode in route_request_error.js |
| 129 enum RouteRequestResultCode { | 128 enum RouteRequestResultCode { |
| 130 UNKNOWN_ERROR, | 129 UNKNOWN_ERROR, |
| 131 OK, | 130 OK, |
| 132 TIMED_OUT, | 131 TIMED_OUT, |
| 133 ROUTE_NOT_FOUND, | 132 ROUTE_NOT_FOUND, |
| 134 SINK_NOT_FOUND, | 133 SINK_NOT_FOUND, |
| 135 INVALID_ORIGIN, | 134 INVALID_ORIGIN, |
| 136 OFF_THE_RECORD_MISMATCH, | 135 INCOGNITO_MISMATCH, |
| 137 NO_SUPPORTED_PROVIDER | 136 NO_SUPPORTED_PROVIDER |
| 138 // New values must be added here. | 137 // New values must be added here. |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 // Modeled after the MediaRouter interface defined in | 140 // Modeled after the MediaRouter interface defined in |
| 142 // chrome/browser/media/router/media_router.h | 141 // chrome/browser/media/router/media_router.h |
| 143 interface MediaRouteProvider { | 142 interface MediaRouteProvider { |
| 144 // 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|. |
| 145 // | 144 // |
| 146 // 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 |
| 147 // may be overridden by a provider implementation. The presentation ID will | 146 // may be overridden by a provider implementation. The presentation ID will |
| 148 // 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. |
| 149 // | 148 // |
| 150 // |origin| and |tab_id| may be passed in for enforcing same-origin and/or | 149 // |origin| and |tab_id| may be passed in for enforcing same-origin and/or |
| 151 // same-tab scopes. Use -1 as |tab_id| in cases where the request is not | 150 // same-tab scopes. Use -1 as |tab_id| in cases where the request is not |
| 152 // made on behalf of a tab. | 151 // made on behalf of a tab. |
| 153 // | 152 // |
| 154 // If |timeout_millis| is positive, it will be used in place of the default | 153 // If |timeout_millis| is positive, it will be used in place of the default |
| 155 // timeout defined by Media Route Provider Manager. | 154 // timeout defined by Media Route Provider Manager. |
| 156 // | 155 // |
| 157 // If |off_the_record| is true, the request was made by an off the record | 156 // If |incognito| is true, the request was made by an incognito profile. |
| 158 // (incognito) profile. | |
| 159 // | 157 // |
| 160 // If the operation was successful, |route| will be defined and | 158 // If the operation was successful, |route| will be defined and |
| 161 // |error_text| will be null. | 159 // |error_text| will be null. |
| 162 // If the operation failed, |route| will be null and |error_text| | 160 // If the operation failed, |route| will be null and |error_text| |
| 163 // will be set. | 161 // will be set. |
| 164 // |result| will be set to OK if successful, or an error code if an error | 162 // |result| will be set to OK if successful, or an error code if an error |
| 165 // occurred. | 163 // occurred. |
| 166 CreateRoute(string media_source, | 164 CreateRoute(string media_source, |
| 167 string sink_id, | 165 string sink_id, |
| 168 string original_presentation_id, | 166 string original_presentation_id, |
| 169 string origin, | 167 string origin, |
| 170 int32 tab_id, | 168 int32 tab_id, |
| 171 int64 timeout_millis, | 169 int64 timeout_millis, |
| 172 bool off_the_record) => | 170 bool incognito) => |
| 173 (MediaRoute? route, | 171 (MediaRoute? route, |
| 174 string? error_text, | 172 string? error_text, |
| 175 RouteRequestResultCode result_code); | 173 RouteRequestResultCode result_code); |
| 176 | 174 |
| 177 // Requests a connection to an established route for |media_source| given | 175 // Requests a connection to an established route for |media_source| given |
| 178 // by |presentation_id|. | 176 // by |presentation_id|. |
| 179 // | 177 // |
| 180 // |origin| and |tab_id| are used for validating same-origin/tab scopes; | 178 // |origin| and |tab_id| are used for validating same-origin/tab scopes; |
| 181 // see CreateRoute for additional documentation. | 179 // see CreateRoute for additional documentation. |
| 182 // | 180 // |
| 183 // If |timeout_millis| is positive, it will be used in place of the default | 181 // If |timeout_millis| is positive, it will be used in place of the default |
| 184 // timeout defined by Media Route Provider Manager. | 182 // timeout defined by Media Route Provider Manager. |
| 185 // | 183 // |
| 186 // If the route request was created by an off the record (incognito) profile, | 184 // If the route request was created by an incognito profile, |
| 187 // |off_the_record| must be true. | 185 // |incognito| must be true. |
| 188 // | 186 // |
| 189 // If the operation was successful, |route| will be defined and | 187 // If the operation was successful, |route| will be defined and |
| 190 // |error_text| will be null. | 188 // |error_text| will be null. |
| 191 // If the operation failed, |route| will be null and |error_text| | 189 // If the operation failed, |route| will be null and |error_text| |
| 192 // will be set. | 190 // will be set. |
| 193 // |result| will be set to OK if successful, or an error code if an error | 191 // |result| will be set to OK if successful, or an error code if an error |
| 194 // occurred. | 192 // occurred. |
| 195 JoinRoute(string media_source, | 193 JoinRoute(string media_source, |
| 196 string presentation_id, | 194 string presentation_id, |
| 197 string origin, | 195 string origin, |
| 198 int32 tab_id, | 196 int32 tab_id, |
| 199 int64 timeout_millis, | 197 int64 timeout_millis, |
| 200 bool off_the_record) => | 198 bool incognito) => |
| 201 (MediaRoute? route, | 199 (MediaRoute? route, |
| 202 string? error_text, | 200 string? error_text, |
| 203 RouteRequestResultCode result_code); | 201 RouteRequestResultCode result_code); |
| 204 | 202 |
| 205 // Creates a new route for |media_source| that connects to the established | 203 // Creates a new route for |media_source| that connects to the established |
| 206 // route given by |route_id|. | 204 // route given by |route_id|. |
| 207 // | 205 // |
| 208 // The presentation ID of the new route will be |presentation_id|, but it may | 206 // The presentation ID of the new route will be |presentation_id|, but it may |
| 209 // be overridden by a provider implementation. The presentation ID will be | 207 // be overridden by a provider implementation. The presentation ID will be |
| 210 // used by the presentation API to refer to the created route. | 208 // used by the presentation API to refer to the created route. |
| 211 // | 209 // |
| 212 // |origin| and |tab_id| are used for validating same-origin/tab scopes; see | 210 // |origin| and |tab_id| are used for validating same-origin/tab scopes; see |
| 213 // CreateRoute for additional documentation. | 211 // CreateRoute for additional documentation. |
| 214 // | 212 // |
| 215 // If |timeout_millis| is positive, it will be used in place of the default | 213 // If |timeout_millis| is positive, it will be used in place of the default |
| 216 // timeout defined by Media Route Provider Manager; see CreateRoute for | 214 // timeout defined by Media Route Provider Manager; see CreateRoute for |
| 217 // additional documentation. | 215 // additional documentation. |
| 218 // | 216 // |
| 219 // If the route request was created by an off the record (incognito) profile, | 217 // If the route request was created by an incognito profile, |
| 220 // |off_the_record| must be true. | 218 // |incognito| must be true. |
| 221 // | 219 // |
| 222 // If the operation was successful, |route| will be defined and | 220 // If the operation was successful, |route| will be defined and |
| 223 // |error_text| will be null. If the operation failed, |route| will be null | 221 // |error_text| will be null. If the operation failed, |route| will be null |
| 224 // and |error_text| will be set. | 222 // and |error_text| will be set. |
| 225 // | 223 // |
| 226 // |result| will be set to OK if successful, or an error code if an error | 224 // |result| will be set to OK if successful, or an error code if an error |
| 227 // occurred. | 225 // occurred. |
| 228 ConnectRouteByRouteId(string media_source, | 226 ConnectRouteByRouteId(string media_source, |
| 229 string route_id, | 227 string route_id, |
| 230 string presentation_id, | 228 string presentation_id, |
| 231 string origin, | 229 string origin, |
| 232 int32 tab_id, | 230 int32 tab_id, |
| 233 int64 timeout_millis, | 231 int64 timeout_millis, |
| 234 bool off_the_record) => | 232 bool incognito) => |
| 235 (MediaRoute? route, | 233 (MediaRoute? route, |
| 236 string? error_text, | 234 string? error_text, |
| 237 RouteRequestResultCode result_code); | 235 RouteRequestResultCode result_code); |
| 238 | 236 |
| 239 // Terminates the route specified by |route_id|. If the route was terminated | 237 // Terminates the route specified by |route_id|. If the route was terminated |
| 240 // successfully, |result_code| is set to OK and |error_text| is null. | 238 // 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 | 239 // Otherwise, |result_code| is an error code and |error_text| describes the |
| 242 // error. | 240 // error. |
| 243 TerminateRoute(string route_id) => | 241 TerminateRoute(string route_id) => |
| 244 (string? error_text, RouteRequestResultCode result_code); | 242 (string? error_text, RouteRequestResultCode result_code); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 383 |
| 386 // Called when the a batch of messages arrives from the media sink for the | 384 // Called when the a batch of messages arrives from the media sink for the |
| 387 // route given by |route_id|. | 385 // route given by |route_id|. |
| 388 // |StartListeningForRouteMessages| must be called first in order to receive | 386 // |StartListeningForRouteMessages| must be called first in order to receive |
| 389 // messages. | 387 // messages. |
| 390 // |route_id|: ID of route of the messages. | 388 // |route_id|: ID of route of the messages. |
| 391 // |messages|: A non-empty list of messages received. | 389 // |messages|: A non-empty list of messages received. |
| 392 OnRouteMessagesReceived(string route_id, | 390 OnRouteMessagesReceived(string route_id, |
| 393 array<RouteMessage> messages); | 391 array<RouteMessage> messages); |
| 394 }; | 392 }; |
| 395 | |
| OLD | NEW |