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 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate | 5 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate |
6 // with this UI. | 6 // with this UI. |
7 cr.define('media_router.ui', function() { | 7 cr.define('media_router.ui', function() { |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 // The media-router-container element. | 10 // The media-router-container element. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 * Populates the WebUI with data obtained from Media Router. | 90 * Populates the WebUI with data obtained from Media Router. |
91 * | 91 * |
92 * @param {{deviceMissingUrl: string, | 92 * @param {{deviceMissingUrl: string, |
93 * sinksAndIdentity: { | 93 * sinksAndIdentity: { |
94 * sinks: !Array<!media_router.Sink>, | 94 * sinks: !Array<!media_router.Sink>, |
95 * showEmail: boolean, | 95 * showEmail: boolean, |
96 * userEmail: string, | 96 * userEmail: string, |
97 * showDomain: boolean | 97 * showDomain: boolean |
98 * }, | 98 * }, |
99 * routes: !Array<!media_router.Route>, | 99 * routes: !Array<!media_router.Route>, |
100 * castModes: !Array<!media_router.CastMode>}} data | 100 * castModes: !Array<!media_router.CastMode>, |
| 101 * useTabMirroring: boolean}} data |
101 * Parameters in data: | 102 * Parameters in data: |
102 * deviceMissingUrl - url to be opened on "Device missing?" clicked. | 103 * deviceMissingUrl - url to be opened on "Device missing?" clicked. |
103 * sinksAndIdentity - list of sinks to be displayed and user identity. | 104 * sinksAndIdentity - list of sinks to be displayed and user identity. |
104 * routes - list of routes that are associated with the sinks. | 105 * routes - list of routes that are associated with the sinks. |
105 * castModes - list of available cast modes. | 106 * castModes - list of available cast modes. |
| 107 * useTabMirroring - whether the cast mode should be set to TAB_MIRROR. |
106 */ | 108 */ |
107 function setInitialData(data) { | 109 function setInitialData(data) { |
108 container.deviceMissingUrl = data['deviceMissingUrl']; | 110 container.deviceMissingUrl = data['deviceMissingUrl']; |
109 container.castModeList = data['castModes']; | 111 container.castModeList = data['castModes']; |
110 this.setSinkListAndIdentity(data['sinksAndIdentity']); | 112 this.setSinkListAndIdentity(data['sinksAndIdentity']); |
111 container.routeList = data['routes']; | 113 container.routeList = data['routes']; |
112 container.maybeShowRouteDetailsOnOpen(); | 114 container.maybeShowRouteDetailsOnOpen(); |
| 115 if (data['useTabMirroring']) |
| 116 container.selectCastMode(media_router.CastModeType.TAB_MIRROR); |
113 media_router.browserApi.onInitialDataReceived(); | 117 media_router.browserApi.onInitialDataReceived(); |
114 } | 118 } |
115 | 119 |
116 /** | 120 /** |
117 * Sets current issue to |issue|, or clears the current issue if |issue| is | 121 * Sets current issue to |issue|, or clears the current issue if |issue| is |
118 * null. | 122 * null. |
119 * | 123 * |
120 * @param {?media_router.Issue} issue | 124 * @param {?media_router.Issue} issue |
121 */ | 125 */ |
122 function setIssue(issue) { | 126 function setIssue(issue) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 reportRouteCreationOutcome: reportRouteCreationOutcome, | 419 reportRouteCreationOutcome: reportRouteCreationOutcome, |
416 reportSelectedCastMode: reportSelectedCastMode, | 420 reportSelectedCastMode: reportSelectedCastMode, |
417 reportSinkCount: reportSinkCount, | 421 reportSinkCount: reportSinkCount, |
418 reportTimeToClickSink: reportTimeToClickSink, | 422 reportTimeToClickSink: reportTimeToClickSink, |
419 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 423 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
420 requestInitialData: requestInitialData, | 424 requestInitialData: requestInitialData, |
421 requestRoute: requestRoute, | 425 requestRoute: requestRoute, |
422 searchSinksAndCreateRoute: searchSinksAndCreateRoute, | 426 searchSinksAndCreateRoute: searchSinksAndCreateRoute, |
423 }; | 427 }; |
424 }); | 428 }); |
OLD | NEW |