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

Side by Side Diff: chrome/browser/resources/md_extensions/sidebar.js

Issue 1913353002: [MD Extensions] Add a details subpage, move to one list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: latest master Created 4 years, 7 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
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.exportPath('extensions');
6
7 // Declare this here to make closure compiler happy, and us sad.
8 /** @enum {number} */
9 extensions.ShowingType = {
10 EXTENSIONS: 0,
11 APPS: 1,
12 };
13
5 cr.define('extensions', function() { 14 cr.define('extensions', function() {
15
6 /** @interface */ 16 /** @interface */
7 var SidebarDelegate = function() {}; 17 var SidebarDelegate = function() {};
8 18
9 SidebarDelegate.prototype = { 19 SidebarDelegate.prototype = {
10 /** 20 /**
11 * Toggles whether or not the profile is in developer mode. 21 * Toggles whether or not the profile is in developer mode.
12 * @param {boolean} inDevMode 22 * @param {boolean} inDevMode
13 */ 23 */
14 setProfileInDevMode: assertNotReached, 24 setProfileInDevMode: assertNotReached,
15 25
16 /** Opens the dialog to load unpacked extensions. */ 26 /** Opens the dialog to load unpacked extensions. */
17 loadUnpacked: assertNotReached, 27 loadUnpacked: assertNotReached,
18 28
19 /** Opens the dialog to pack an extension. */ 29 /** Opens the dialog to pack an extension. */
20 packExtension: assertNotReached, 30 packExtension: assertNotReached,
21 31
22 /** Updates all extensions. */ 32 /** Updates all extensions. */
23 updateAllExtensions: assertNotReached, 33 updateAllExtensions: assertNotReached,
24 }; 34 };
25 35
26 /** @interface */ 36 /** @interface */
27 var SidebarScrollDelegate = function() {}; 37 var SidebarListDelegate = function() {};
28 38
29 SidebarScrollDelegate.prototype = { 39 SidebarListDelegate.prototype = {
30 /** Scrolls to the extensions section. */ 40 /**
31 scrollToExtensions: assertNotReached, 41 * Shows the given type of item.
32 42 * @param {extensions.ShowingType} type
33 /** Scrolls to the apps section. */ 43 */
34 scrollToApps: assertNotReached, 44 showType: assertNotReached,
35
36 /** Scrolls to the websites section. */
37 scrollToWebsites: assertNotReached,
38 }; 45 };
39 46
40 var Sidebar = Polymer({ 47 var Sidebar = Polymer({
41 is: 'extensions-sidebar', 48 is: 'extensions-sidebar',
42 49
43 properties: { 50 properties: {
44 inDevMode: { 51 inDevMode: {
45 type: Boolean, 52 type: Boolean,
46 value: false, 53 value: false,
47 }, 54 },
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 }, 55 },
64 56
65 behaviors: [ 57 behaviors: [I18nBehavior],
66 I18nBehavior,
67 ],
68 58
69 /** @param {extensions.SidebarDelegate} delegate */ 59 /** @param {extensions.SidebarDelegate} delegate */
70 setDelegate: function(delegate) { 60 setDelegate: function(delegate) {
71 /** @private {extensions.SidebarDelegate} */ 61 /** @private {extensions.SidebarDelegate} */
72 this.delegate_ = delegate; 62 this.delegate_ = delegate;
73 }, 63 },
74 64
75 /** @param {extensions.SidebarScrollDelegate} scrollDelegate */ 65 /** @param {extensions.SidebarListDelegate} listDelegate */
76 setScrollDelegate: function(scrollDelegate) { 66 setListDelegate: function(listDelegate) {
77 /** @private {extensions.SidebarScrollDelegate} */ 67 /** @private {extensions.SidebarListDelegate} */
78 this.scrollDelegate_ = scrollDelegate; 68 this.listDelegate_ = listDelegate;
79 }, 69 },
80 70
81 /** @private */ 71 /** @private */
82 onExtensionsTap_: function() { 72 onExtensionsTap_: function() {
83 this.scrollDelegate_.scrollToExtensions(); 73 this.listDelegate_.showType(extensions.ShowingType.EXTENSIONS);
84 }, 74 },
85 75
86 /** @private */ 76 /** @private */
87 onAppsTap_: function() { 77 onAppsTap_: function() {
88 this.scrollDelegate_.scrollToApps(); 78 this.listDelegate_.showType(extensions.ShowingType.APPS);
89 }, 79 },
90 80
91 /** @private */ 81 /** @private */
92 onWebsitesTap_: function() {
93 this.scrollDelegate_.scrollToWebsites();
94 },
95
96 /** @private */
97 onDevModeChange_: function() { 82 onDevModeChange_: function() {
98 this.delegate_.setProfileInDevMode( 83 this.delegate_.setProfileInDevMode(
99 this.$['developer-mode-checkbox'].checked); 84 this.$['developer-mode-checkbox'].checked);
100 }, 85 },
101 86
102 /** @private */ 87 /** @private */
103 onLoadUnpackedTap_: function() { 88 onLoadUnpackedTap_: function() {
104 this.delegate_.loadUnpacked(); 89 this.delegate_.loadUnpacked();
105 }, 90 },
106 91
107 /** @private */ 92 /** @private */
108 onPackTap_: function() { 93 onPackTap_: function() {
109 this.delegate_.packExtension(); 94 this.delegate_.packExtension();
110 }, 95 },
111 96
112 /** @private */ 97 /** @private */
113 onUpdateNowTap_: function() { 98 onUpdateNowTap_: function() {
114 this.delegate_.updateAllExtensions(); 99 this.delegate_.updateAllExtensions();
115 }, 100 },
116 }); 101 });
117 102
118 return { 103 return {
119 Sidebar: Sidebar, 104 Sidebar: Sidebar,
120 SidebarDelegate: SidebarDelegate, 105 SidebarDelegate: SidebarDelegate,
121 SidebarScrollDelegate: SidebarScrollDelegate, 106 SidebarListDelegate: SidebarListDelegate,
122 }; 107 };
123 }); 108 });
124 109
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_extensions/sidebar.html ('k') | chrome/browser/ui/webui/extensions/extensions_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698