Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/resources/media_router/elements/route_details/route_details.js

Issue 2002293003: [Media Router] Allow casting new media to sink with existing route. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Responding to apacible's comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This Polymer element shows information from media that is currently cast 5 // This Polymer element shows information from media that is currently cast
6 // to a device. 6 // to a device.
7 Polymer({ 7 Polymer({
8 is: 'route-details', 8 is: 'route-details',
9 9
10 properties: { 10 properties: {
11 /** 11 /**
12 * The text for the current casting activity status. 12 * The text for the current casting activity status.
13 * @private {string|undefined} 13 * @private {string|undefined}
14 */ 14 */
15 activityStatus_: { 15 activityStatus_: {
16 type: String, 16 type: String,
17 }, 17 },
18 18
19 /** 19 /**
20 * Bitmask of available cast modes compatible with the sink of the current
21 * route.
22 * @type {number}
23 */
24 availableCastModes: {
25 type: Number,
26 value: 0,
27 },
28
29 /**
20 * Whether the browser is currently incognito. 30 * Whether the browser is currently incognito.
21 * @type {boolean|undefined} 31 * @type {boolean|undefined}
22 */ 32 */
23 isOffTheRecord: { 33 isOffTheRecord: {
24 type: Boolean, 34 type: Boolean,
25 }, 35 },
26 36
27 /** 37 /**
28 * The route to show. 38 * The route to show.
29 * @type {?media_router.Route|undefined} 39 * @type {?media_router.Route|undefined}
(...skipping 23 matching lines...) Expand all
53 * Fires a close-route-click event. This is called when the button to close 63 * Fires a close-route-click event. This is called when the button to close
54 * the current route is clicked. 64 * the current route is clicked.
55 * 65 *
56 * @private 66 * @private
57 */ 67 */
58 closeRoute_: function() { 68 closeRoute_: function() {
59 this.fire('close-route-click', {route: this.route}); 69 this.fire('close-route-click', {route: this.route});
60 }, 70 },
61 71
62 /** 72 /**
63 * Fires a start-casting-to-route-click event. This is called when the button 73 * @param {?media_router.Route|undefined} route
64 * to start casting to the current route is clicked. 74 * @param {number} availableCastModes
75 * @return {boolean} Whether to show the button that allows casting to the
76 * current route or the current route's sink.
77 */
78 computeCastButtonHidden_: function(route, availableCastModes) {
79 return !(route && route.canJoin) && !availableCastModes;
80 },
81
82 /**
83 * Fires a join-route-click event if the current route is joinable, otherwise
84 * it fires a cast-new-media-click event. This is called when the button to
apacible 2016/05/25 22:37:01 nit: "... a cast-new-media-click event, which stop
btolsch 2016/05/26 00:31:12 Done.
85 * start casting to the current route is clicked.
65 * 86 *
66 * @private 87 * @private
67 */ 88 */
68 startCastingToRoute_: function() { 89 startCastingToRoute_: function() {
69 this.fire('start-casting-to-route-click', {route: this.route}); 90 if (this.route.canJoin) {
91 this.fire('join-route-click', {route: this.route});
92 } else {
93 this.fire('cast-new-media-click', {route: this.route});
apacible 2016/05/25 22:37:01 What happens if there's already a pending created
btolsch 2016/05/26 00:31:12 Currently, only the sink for this route would show
94 }
70 }, 95 },
71 96
72 /** 97 /**
73 * Loads the custom controller if |route.customControllerPath| exists. 98 * Loads the custom controller if |route.customControllerPath| exists.
74 * Falls back to the default route details view otherwise, or if load fails. 99 * Falls back to the default route details view otherwise, or if load fails.
75 * Updates |activityStatus_| for the default view. 100 * Updates |activityStatus_| for the default view.
76 * 101 *
77 * @private 102 * @private
78 */ 103 */
79 maybeLoadCustomController_: function() { 104 maybeLoadCustomController_: function() {
(...skipping 20 matching lines...) Expand all
100 extensionview.load(this.route.customControllerPath) 125 extensionview.load(this.route.customControllerPath)
101 .then(function() { 126 .then(function() {
102 // Load was successful; show the custom controller. 127 // Load was successful; show the custom controller.
103 that.isCustomControllerHidden_ = false; 128 that.isCustomControllerHidden_ = false;
104 }, function() { 129 }, function() {
105 // Load was unsuccessful; fall back to default view. 130 // Load was unsuccessful; fall back to default view.
106 that.isCustomControllerHidden_ = true; 131 that.isCustomControllerHidden_ = true;
107 }); 132 });
108 }, 133 },
109 }); 134 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698