Chromium Code Reviews| Index: chrome/browser/resources/media_router/elements/route_details/extension_view_wrapper/extension_view_wrapper.js |
| diff --git a/chrome/browser/resources/media_router/elements/route_details/extension_view_wrapper/extension_view_wrapper.js b/chrome/browser/resources/media_router/elements/route_details/extension_view_wrapper/extension_view_wrapper.js |
| index 997e7e081efd4c4d6f7faf8381eb6e95c2adda88..e29195b95a30c0429c6a0a00c98fd7a75a714efa 100644 |
| --- a/chrome/browser/resources/media_router/elements/route_details/extension_view_wrapper/extension_view_wrapper.js |
| +++ b/chrome/browser/resources/media_router/elements/route_details/extension_view_wrapper/extension_view_wrapper.js |
| @@ -9,6 +9,16 @@ Polymer({ |
| properties: { |
| /** |
| + * Whether the extension view is ready to be shown. |
| + * @type {boolean} |
| + */ |
| + isExtensionViewReady: { |
| + type: Boolean, |
| + value: false, |
| + notify: true, |
| + }, |
| + |
| + /** |
| * The route to show the custom controller for. |
| * @type {?media_router.Route|undefined} |
| */ |
| @@ -18,13 +28,12 @@ Polymer({ |
| }, |
| /** |
| - * Whether the extension view is ready to be shown. |
| - * @type {boolean} |
| + * The time when the route details view was opened. |
| + * @type {?Date} |
| */ |
| - isExtensionViewReady: { |
| - type: Boolean, |
| - value: false, |
| - notify: true, |
| + routeDetailsOpenTime: { |
| + type: Date, |
| + value: null, |
| }, |
| }, |
| @@ -36,21 +45,35 @@ Polymer({ |
| }, |
| /** |
| + * @return {?string} |
| + */ |
| + getCustomControllerPath_: function() { |
| + if (!this.route.customControllerPath) { |
| + return null; |
| + } |
| + if (!this.routeDetailsOpenTime) { |
| + return this.route.customControllerPath; |
| + } |
| + return controllerPath = this.route.customControllerPath + |
|
imcheng
2017/06/02 23:53:13
The "controllerPath = " seems redundant - remove?
takumif
2017/06/03 01:31:14
Done.
|
| + '&requestTimestamp=' + this.routeDetailsOpenTime.getTime(); |
| + }, |
| + |
| + /** |
| * Loads the custom controller if the controller path for the current route is |
| * valid. |
| */ |
| maybeLoadExtensionView_: function() { |
| - var extensionview = this.$['custom-controller']; |
| + /** @const */ var extensionview = this.$['custom-controller']; |
|
imcheng
2017/06/02 23:53:13
Does it work if you replaced "var" with "const"?
takumif
2017/06/03 01:31:14
The Closure compiler complains if you do that :(
imcheng
2017/06/05 17:44:26
What's the error message?
takumif
2017/06/05 17:50:16
It simply says:
Found JavaScript style violations
|
| + /** @const */ var controllerPath = this.getCustomControllerPath_(); |
| // Do nothing if the controller path doesn't exist or is already shown in |
| // the extension view. |
| - if (!this.route || !this.route.customControllerPath || |
| - this.route.customControllerPath == extensionview.src) { |
| + if (!this.route || !controllerPath || controllerPath == extensionview.src) { |
| return; |
| } |
| - var that = this; |
| - extensionview.load(this.route.customControllerPath) |
| + /** @const */ var that = this; |
| + extensionview.load(controllerPath) |
| .then( |
| function() { |
| // Load was successful; show the custom controller. |