Chromium Code Reviews| Index: chrome/browser/resources/md_extensions/sidebar.js |
| diff --git a/chrome/browser/resources/md_extensions/sidebar.js b/chrome/browser/resources/md_extensions/sidebar.js |
| index 622c5ec3ada68aacad544a66042d0a361752bf01..e168854b554dd282012bcfb85327f83b7c49c1b1 100644 |
| --- a/chrome/browser/resources/md_extensions/sidebar.js |
| +++ b/chrome/browser/resources/md_extensions/sidebar.js |
| @@ -3,6 +3,12 @@ |
| // found in the LICENSE file. |
| cr.define('extensions', function() { |
| + /** @enum {number} */ |
| + var ShowingType = { |
| + EXTENSIONS: 0, |
| + APPS: 1, |
| + }; |
| + |
| /** @interface */ |
| var SidebarDelegate = function() {}; |
| @@ -24,17 +30,14 @@ cr.define('extensions', function() { |
| }; |
| /** @interface */ |
| - var SidebarScrollDelegate = function() {}; |
| - |
| - SidebarScrollDelegate.prototype = { |
| - /** Scrolls to the extensions section. */ |
| - scrollToExtensions: assertNotReached, |
| + var SidebarListDelegate = function() {}; |
| - /** Scrolls to the apps section. */ |
| - scrollToApps: assertNotReached, |
| - |
| - /** Scrolls to the websites section. */ |
| - scrollToWebsites: assertNotReached, |
| + SidebarListDelegate.prototype = { |
| + /** |
| + * Shows the given type of item. |
| + * @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
|
| + */ |
| + showType: assertNotReached, |
| }; |
| var Sidebar = Polymer({ |
| @@ -45,26 +48,9 @@ cr.define('extensions', function() { |
| type: Boolean, |
| value: false, |
| }, |
| - |
| - hideExtensionsButton: { |
| - type: Boolean, |
| - value: false, |
| - }, |
| - |
| - hideAppsButton: { |
| - type: Boolean, |
| - value: false, |
| - }, |
| - |
| - hideWebsitesButton: { |
| - type: Boolean, |
| - value: false, |
| - }, |
| }, |
| - behaviors: [ |
| - I18nBehavior, |
| - ], |
| + behaviors: [I18nBehavior], |
| /** @param {extensions.SidebarDelegate} delegate */ |
| setDelegate: function(delegate) { |
| @@ -72,25 +58,20 @@ cr.define('extensions', function() { |
| this.delegate_ = delegate; |
| }, |
| - /** @param {extensions.SidebarScrollDelegate} scrollDelegate */ |
| - setScrollDelegate: function(scrollDelegate) { |
| - /** @private {extensions.SidebarScrollDelegate} */ |
| - this.scrollDelegate_ = scrollDelegate; |
| + /** @param {extensions.SidebarListDelegate} listDelegate */ |
| + setListDelegate: function(listDelegate) { |
| + /** @private {extensions.SidebarListDelegate} */ |
| + this.listDelegate_ = listDelegate; |
| }, |
| /** @private */ |
| onExtensionsTap_: function() { |
| - this.scrollDelegate_.scrollToExtensions(); |
| + this.listDelegate_.showType(ShowingType.EXTENSIONS); |
| }, |
| /** @private */ |
| onAppsTap_: function() { |
| - this.scrollDelegate_.scrollToApps(); |
| - }, |
| - |
| - /** @private */ |
| - onWebsitesTap_: function() { |
| - this.scrollDelegate_.scrollToWebsites(); |
| + this.listDelegate_.showType(ShowingType.APPS); |
| }, |
| /** @private */ |
| @@ -116,9 +97,10 @@ cr.define('extensions', function() { |
| }); |
| return { |
| + ShowingType: ShowingType, |
| Sidebar: Sidebar, |
| SidebarDelegate: SidebarDelegate, |
| - SidebarScrollDelegate: SidebarScrollDelegate, |
| + SidebarListDelegate: SidebarListDelegate, |
| }; |
| }); |