Chromium Code Reviews| 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 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 /** @enum {number} */ | |
| 7 var ShowingType = { | |
| 8 EXTENSIONS: 0, | |
| 9 APPS: 1, | |
| 10 }; | |
| 11 | |
| 6 /** @interface */ | 12 /** @interface */ |
| 7 var SidebarDelegate = function() {}; | 13 var SidebarDelegate = function() {}; |
| 8 | 14 |
| 9 SidebarDelegate.prototype = { | 15 SidebarDelegate.prototype = { |
| 10 /** | 16 /** |
| 11 * Toggles whether or not the profile is in developer mode. | 17 * Toggles whether or not the profile is in developer mode. |
| 12 * @param {boolean} inDevMode | 18 * @param {boolean} inDevMode |
| 13 */ | 19 */ |
| 14 setProfileInDevMode: assertNotReached, | 20 setProfileInDevMode: assertNotReached, |
| 15 | 21 |
| 16 /** Opens the dialog to load unpacked extensions. */ | 22 /** Opens the dialog to load unpacked extensions. */ |
| 17 loadUnpacked: assertNotReached, | 23 loadUnpacked: assertNotReached, |
| 18 | 24 |
| 19 /** Opens the dialog to pack an extension. */ | 25 /** Opens the dialog to pack an extension. */ |
| 20 packExtension: assertNotReached, | 26 packExtension: assertNotReached, |
| 21 | 27 |
| 22 /** Updates all extensions. */ | 28 /** Updates all extensions. */ |
| 23 updateAllExtensions: assertNotReached, | 29 updateAllExtensions: assertNotReached, |
| 24 }; | 30 }; |
| 25 | 31 |
| 26 /** @interface */ | 32 /** @interface */ |
| 27 var SidebarScrollDelegate = function() {}; | 33 var SidebarListDelegate = function() {}; |
| 28 | 34 |
| 29 SidebarScrollDelegate.prototype = { | 35 SidebarListDelegate.prototype = { |
| 30 /** Scrolls to the extensions section. */ | 36 /** |
| 31 scrollToExtensions: assertNotReached, | 37 * Shows the given type of item. |
| 32 | 38 * @param {*} type (Closure says "ShowingType" is undefined) |
|
Dan Beam
2016/05/03 19:16:49
maybe try:
cr.exportPath('extensions');
/** @enu
Devlin
2016/05/03 19:56:55
Yep, that worked. Annoying that we can't do it th
Dan Beam
2016/05/03 20:55:04
i think it's a long-standing bug in the old closur
| |
| 33 /** Scrolls to the apps section. */ | 39 */ |
| 34 scrollToApps: assertNotReached, | 40 showType: assertNotReached, |
| 35 | |
| 36 /** Scrolls to the websites section. */ | |
| 37 scrollToWebsites: assertNotReached, | |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 var Sidebar = Polymer({ | 43 var Sidebar = Polymer({ |
| 41 is: 'extensions-sidebar', | 44 is: 'extensions-sidebar', |
| 42 | 45 |
| 43 properties: { | 46 properties: { |
| 44 inDevMode: { | 47 inDevMode: { |
| 45 type: Boolean, | 48 type: Boolean, |
| 46 value: false, | 49 value: false, |
| 47 }, | 50 }, |
| 48 | |
| 49 hideExtensionsButton: { | |
| 50 type: Boolean, | |
| 51 value: false, | |
| 52 }, | |
| 53 | |
| 54 hideAppsButton: { | |
| 55 type: Boolean, | |
| 56 value: false, | |
| 57 }, | |
| 58 | |
| 59 hideWebsitesButton: { | |
| 60 type: Boolean, | |
| 61 value: false, | |
| 62 }, | |
| 63 }, | 51 }, |
| 64 | 52 |
| 65 behaviors: [ | 53 behaviors: [I18nBehavior], |
| 66 I18nBehavior, | |
| 67 ], | |
| 68 | 54 |
| 69 /** @param {extensions.SidebarDelegate} delegate */ | 55 /** @param {extensions.SidebarDelegate} delegate */ |
| 70 setDelegate: function(delegate) { | 56 setDelegate: function(delegate) { |
| 71 /** @private {extensions.SidebarDelegate} */ | 57 /** @private {extensions.SidebarDelegate} */ |
| 72 this.delegate_ = delegate; | 58 this.delegate_ = delegate; |
| 73 }, | 59 }, |
| 74 | 60 |
| 75 /** @param {extensions.SidebarScrollDelegate} scrollDelegate */ | 61 /** @param {extensions.SidebarListDelegate} listDelegate */ |
| 76 setScrollDelegate: function(scrollDelegate) { | 62 setListDelegate: function(listDelegate) { |
| 77 /** @private {extensions.SidebarScrollDelegate} */ | 63 /** @private {extensions.SidebarListDelegate} */ |
| 78 this.scrollDelegate_ = scrollDelegate; | 64 this.listDelegate_ = listDelegate; |
| 79 }, | 65 }, |
| 80 | 66 |
| 81 /** @private */ | 67 /** @private */ |
| 82 onExtensionsTap_: function() { | 68 onExtensionsTap_: function() { |
| 83 this.scrollDelegate_.scrollToExtensions(); | 69 this.listDelegate_.showType(ShowingType.EXTENSIONS); |
| 84 }, | 70 }, |
| 85 | 71 |
| 86 /** @private */ | 72 /** @private */ |
| 87 onAppsTap_: function() { | 73 onAppsTap_: function() { |
| 88 this.scrollDelegate_.scrollToApps(); | 74 this.listDelegate_.showType(ShowingType.APPS); |
| 89 }, | 75 }, |
| 90 | 76 |
| 91 /** @private */ | 77 /** @private */ |
| 92 onWebsitesTap_: function() { | |
| 93 this.scrollDelegate_.scrollToWebsites(); | |
| 94 }, | |
| 95 | |
| 96 /** @private */ | |
| 97 onDevModeChange_: function() { | 78 onDevModeChange_: function() { |
| 98 this.delegate_.setProfileInDevMode( | 79 this.delegate_.setProfileInDevMode( |
| 99 this.$['developer-mode-checkbox'].checked); | 80 this.$['developer-mode-checkbox'].checked); |
| 100 }, | 81 }, |
| 101 | 82 |
| 102 /** @private */ | 83 /** @private */ |
| 103 onLoadUnpackedTap_: function() { | 84 onLoadUnpackedTap_: function() { |
| 104 this.delegate_.loadUnpacked(); | 85 this.delegate_.loadUnpacked(); |
| 105 }, | 86 }, |
| 106 | 87 |
| 107 /** @private */ | 88 /** @private */ |
| 108 onPackTap_: function() { | 89 onPackTap_: function() { |
| 109 this.delegate_.packExtension(); | 90 this.delegate_.packExtension(); |
| 110 }, | 91 }, |
| 111 | 92 |
| 112 /** @private */ | 93 /** @private */ |
| 113 onUpdateNowTap_: function() { | 94 onUpdateNowTap_: function() { |
| 114 this.delegate_.updateAllExtensions(); | 95 this.delegate_.updateAllExtensions(); |
| 115 }, | 96 }, |
| 116 }); | 97 }); |
| 117 | 98 |
| 118 return { | 99 return { |
| 100 ShowingType: ShowingType, | |
| 119 Sidebar: Sidebar, | 101 Sidebar: Sidebar, |
| 120 SidebarDelegate: SidebarDelegate, | 102 SidebarDelegate: SidebarDelegate, |
| 121 SidebarScrollDelegate: SidebarScrollDelegate, | 103 SidebarListDelegate: SidebarListDelegate, |
| 122 }; | 104 }; |
| 123 }); | 105 }); |
| 124 | 106 |
| OLD | NEW |