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

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

Issue 2725503002: [Media Router] Custom Controls 4 - Implement details view WebUI (Closed)
Patch Set: Add braces to @implements {Interface} Created 3 years, 6 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
(Empty)
1 // Copyright 2017 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.
4
5 // This Polymer element shows the custom controller for a route using
6 // extensionview.
7 Polymer({
8 is: 'extension-view-wrapper',
9
10 properties: {
11 /**
12 * The route to show the custom controller for.
13 * @type {?media_router.Route|undefined}
14 */
15 route: {
16 type: Object,
17 observer: 'maybeLoadExtensionView_',
18 },
19
20 /**
21 * Whether the extension view is ready to be shown.
22 * @type {boolean}
23 */
24 isExtensionViewReady: {
25 type: Boolean,
26 value: false,
27 notify: true,
28 },
29 },
30
31 /**
32 * Called by Polymer when this module has loaded.
33 */
34 ready: function() {
35 this.maybeLoadExtensionView_();
36 },
37
38 /**
39 * Loads the custom controller if the controller path for the current route is
40 * valid.
41 */
42 maybeLoadExtensionView_: function() {
43 var extensionview = this.$['custom-controller'];
44
45 // Do nothing if the controller path doesn't exist or is already shown in
46 // the extension view.
47 if (!this.route || !this.route.customControllerPath ||
48 this.route.customControllerPath == extensionview.src) {
49 return;
50 }
51
52 var that = this;
53 extensionview.load(this.route.customControllerPath)
54 .then(
55 function() {
56 // Load was successful; show the custom controller.
57 that.isExtensionViewReady = true;
58 },
59 function() {
60 // Load was unsuccessful; fall back to default view.
61 that.isExtensionViewReady = false;
62 });
63 },
64 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698