| 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 /** @interface */ | 6 /** @interface */ |
| 7 var SidebarDelegate = function() {}; | 7 var SidebarDelegate = function() {}; |
| 8 | 8 |
| 9 SidebarDelegate.prototype = { | 9 SidebarDelegate.prototype = { |
| 10 /** | 10 /** |
| 11 * Toggles whether or not the profile is in developer mode. | 11 * Toggles whether or not the profile is in developer mode. |
| 12 * @param {boolean} inDevMode | 12 * @param {boolean} inDevMode |
| 13 */ | 13 */ |
| 14 setProfileInDevMode: assertNotReached, | 14 setProfileInDevMode: assertNotReached, |
| 15 | 15 |
| 16 /** Opens the dialog to load unpacked extensions. */ | 16 /** Opens the dialog to load unpacked extensions. */ |
| 17 loadUnpacked: assertNotReached, | 17 loadUnpacked: assertNotReached, |
| 18 | 18 |
| 19 /** Opens the dialog to pack an extension. */ | 19 /** Opens the dialog to pack an extension. */ |
| 20 packExtension: assertNotReached, | 20 packExtension: assertNotReached, |
| 21 | 21 |
| 22 /** Updates all extensions. */ | 22 /** Updates all extensions. */ |
| 23 updateAllExtensions: assertNotReached, | 23 updateAllExtensions: assertNotReached, |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 /** @interface */ | 26 /** @interface */ |
| 27 var SidebarScrollDelegate = function() {}; | 27 var SidebarListDelegate = function() {}; |
| 28 | 28 |
| 29 SidebarScrollDelegate.prototype = { | 29 SidebarListDelegate.prototype = { |
| 30 /** Scrolls to the extensions section. */ | 30 /** Shows extensions. */ |
| 31 scrollToExtensions: assertNotReached, | 31 showExtensions: assertNotReached, |
| 32 | 32 |
| 33 /** Scrolls to the apps section. */ | 33 /** Shows apps. */ |
| 34 scrollToApps: assertNotReached, | 34 showApps: assertNotReached, |
| 35 | |
| 36 /** Scrolls to the websites section. */ | |
| 37 scrollToWebsites: assertNotReached, | |
| 38 }; | 35 }; |
| 39 | 36 |
| 40 var Sidebar = Polymer({ | 37 var Sidebar = Polymer({ |
| 41 is: 'extensions-sidebar', | 38 is: 'extensions-sidebar', |
| 42 | 39 |
| 43 properties: { | 40 properties: { |
| 44 inDevMode: { | 41 inDevMode: { |
| 45 type: Boolean, | 42 type: Boolean, |
| 46 value: false, | 43 value: false, |
| 47 }, | 44 }, |
| 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 }, | 45 }, |
| 64 | 46 |
| 65 behaviors: [ | 47 behaviors: [I18nBehavior], |
| 66 I18nBehavior, | |
| 67 ], | |
| 68 | 48 |
| 69 /** @param {extensions.SidebarDelegate} delegate */ | 49 /** @param {extensions.SidebarDelegate} delegate */ |
| 70 setDelegate: function(delegate) { | 50 setDelegate: function(delegate) { |
| 71 /** @private {extensions.SidebarDelegate} */ | 51 /** @private {extensions.SidebarDelegate} */ |
| 72 this.delegate_ = delegate; | 52 this.delegate_ = delegate; |
| 73 }, | 53 }, |
| 74 | 54 |
| 75 /** @param {extensions.SidebarScrollDelegate} scrollDelegate */ | 55 /** @param {extensions.SidebarListDelegate} listDelegate */ |
| 76 setScrollDelegate: function(scrollDelegate) { | 56 setListDelegate: function(listDelegate) { |
| 77 /** @private {extensions.SidebarScrollDelegate} */ | 57 /** @private {extensions.SidebarListDelegate} */ |
| 78 this.scrollDelegate_ = scrollDelegate; | 58 this.listDelegate_ = listDelegate; |
| 79 }, | 59 }, |
| 80 | 60 |
| 81 /** @private */ | 61 /** @private */ |
| 82 onExtensionsTap_: function() { | 62 onExtensionsTap_: function() { |
| 83 this.scrollDelegate_.scrollToExtensions(); | 63 this.listDelegate_.showExtensions(); |
| 84 }, | 64 }, |
| 85 | 65 |
| 86 /** @private */ | 66 /** @private */ |
| 87 onAppsTap_: function() { | 67 onAppsTap_: function() { |
| 88 this.scrollDelegate_.scrollToApps(); | 68 this.listDelegate_.showApps(); |
| 89 }, | 69 }, |
| 90 | 70 |
| 91 /** @private */ | 71 /** @private */ |
| 92 onWebsitesTap_: function() { | |
| 93 this.scrollDelegate_.scrollToWebsites(); | |
| 94 }, | |
| 95 | |
| 96 /** @private */ | |
| 97 onDevModeChange_: function() { | 72 onDevModeChange_: function() { |
| 98 this.delegate_.setProfileInDevMode( | 73 this.delegate_.setProfileInDevMode( |
| 99 this.$['developer-mode-checkbox'].checked); | 74 this.$['developer-mode-checkbox'].checked); |
| 100 }, | 75 }, |
| 101 | 76 |
| 102 /** @private */ | 77 /** @private */ |
| 103 onLoadUnpackedTap_: function() { | 78 onLoadUnpackedTap_: function() { |
| 104 this.delegate_.loadUnpacked(); | 79 this.delegate_.loadUnpacked(); |
| 105 }, | 80 }, |
| 106 | 81 |
| 107 /** @private */ | 82 /** @private */ |
| 108 onPackTap_: function() { | 83 onPackTap_: function() { |
| 109 this.delegate_.packExtension(); | 84 this.delegate_.packExtension(); |
| 110 }, | 85 }, |
| 111 | 86 |
| 112 /** @private */ | 87 /** @private */ |
| 113 onUpdateNowTap_: function() { | 88 onUpdateNowTap_: function() { |
| 114 this.delegate_.updateAllExtensions(); | 89 this.delegate_.updateAllExtensions(); |
| 115 }, | 90 }, |
| 116 }); | 91 }); |
| 117 | 92 |
| 118 return { | 93 return { |
| 119 Sidebar: Sidebar, | 94 Sidebar: Sidebar, |
| 120 SidebarDelegate: SidebarDelegate, | 95 SidebarDelegate: SidebarDelegate, |
| 121 SidebarScrollDelegate: SidebarScrollDelegate, | 96 SidebarListDelegate: SidebarListDelegate, |
| 122 }; | 97 }; |
| 123 }); | 98 }); |
| 124 | 99 |
| OLD | NEW |