cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / browser / resources / media_router / elements / route_details / route_details.js
blob43d1aba1cf2192b4d8c4467e8f04c53b1b267256
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
3 // found in the LICENSE file.
5 // This Polymer element shows information from media that is currently cast
6 // to a device. It is assumed that |route| and |sink| correspond to each other.
7 Polymer({
8 is: 'route-details',
10 properties: {
11 /**
12 * The text for the current casting activity status.
13 * @private {string}
15 activityStatus_: {
16 type: String,
17 value: '',
20 /**
21 * The route to show.
22 * @type {?media_router.Route}
24 route: {
25 type: Object,
26 value: null,
27 observer: 'maybeLoadCustomController_',
30 /**
31 * The sink to show.
32 * @type {?media_router.Sink}
34 sink: {
35 type: Object,
36 value: null,
39 /**
40 * The text for the stop casting button.
41 * @private {string}
43 stopCastingButtonText_: {
44 type: String,
45 value: loadTimeData.getString('stopCastingButton'),
48 /**
49 * Whether the custom controller should be hidden.
50 * A custom controller is shown iff |route| specifies customControllerPath
51 * and the view can be loaded.
52 * @private {boolean}
54 isCustomControllerHidden_: {
55 type: Boolean,
56 value: true,
60 /**
61 * Fires a back-click event. This is called when the back link is clicked.
63 * @private
65 back_: function() {
66 this.fire('back-click');
69 /**
70 * Fires a close-route-click event. This is called when the button to close
71 * the current route is clicked.
73 * @private
75 closeRoute_: function() {
76 this.fire('close-route-click', {route: this.route});
79 /**
80 * Loads the custom controller if |route.customControllerPath| exists.
81 * Falls back to the default route details view otherwise, or if load fails.
82 * Updates |activityStatus_| for the default view.
84 * @private
86 maybeLoadCustomController_: function() {
87 this.activityStatus_ = this.route ?
88 loadTimeData.getStringF('castingActivityStatus',
89 this.route.description) :
90 '';
92 if (!this.route || !this.route.customControllerPath) {
93 this.isCustomControllerHidden_ = true;
94 return;
97 // Show custom controller
98 var extensionview = this.$['custom-controller'];
100 // Do nothing if the url is the same and the view is not hidden.
101 if (this.route.customControllerPath == extensionview.src &&
102 !this.isCustomControllerHidden_)
103 return;
105 var that = this;
106 extensionview.load(this.route.customControllerPath)
107 .then(function() {
108 // Load was successful; show the custom controller.
109 that.isCustomControllerHidden_ = false;
110 }, function() {
111 // Load was unsuccessful; fall back to default view.
112 that.isCustomControllerHidden_ = true;
117 * Handles a click on the close button by firing a close-button-click event.
119 * @private
121 onCloseButtonClick_: function() {
122 this.fire('close-button-click');