OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Used for observing function of the backend datasource for this page by | 5 // Used for observing function of the backend datasource for this page by |
6 // tests. | 6 // tests. |
7 var webui_responded_ = false; | 7 var webui_responded_ = false; |
8 | 8 |
9 cr.define('options', function() { | 9 cr.define('options', function() { |
10 var OptionsPage = options.OptionsPage; | 10 var OptionsPage = options.OptionsPage; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 * Called by the dom_ui_ to re-populate the page with data representing | 146 * Called by the dom_ui_ to re-populate the page with data representing |
147 * the current state of installed extensions. | 147 * the current state of installed extensions. |
148 */ | 148 */ |
149 ExtensionSettings.returnExtensionsData = function(extensionsData) { | 149 ExtensionSettings.returnExtensionsData = function(extensionsData) { |
150 webui_responded_ = true; | 150 webui_responded_ = true; |
151 | 151 |
152 $('no-extensions').hidden = true; | 152 $('no-extensions').hidden = true; |
153 $('suggest-gallery').hidden = true; | 153 $('suggest-gallery').hidden = true; |
154 $('get-more-extensions-container').hidden = true; | 154 $('get-more-extensions-container').hidden = true; |
155 | 155 |
156 // Append extension count to extensionSettingsTitle and frame | |
157 // the extension header string. If there are no extensions loaded | |
158 // then display title as Extensions only. | |
159 $('extension-settings-header').hidden = false; | |
160 $('dev-toggle').hidden = false; | |
161 var extensionSettingsHeader = templateData.extensionSettingsTitle; | |
162 if (extensionsData.extensions.length > 0) { | |
163 extensionSettingsHeader = templateData.extensionSettingsTitle + " (" + | |
164 extensionsData.extensions.length + | |
165 ")"; | |
Finnur
2011/09/19 16:48:41
nit: Move this to the line above.
| |
166 } | |
167 | |
168 $('extension-settings-header').innerText = extensionSettingsHeader; | |
169 | |
156 if (extensionsData.extensions.length > 0) { | 170 if (extensionsData.extensions.length > 0) { |
157 // Enforce order specified in the data or (if equal) then sort by | 171 // Enforce order specified in the data or (if equal) then sort by |
158 // extension name (case-insensitive). | 172 // extension name (case-insensitive). |
159 extensionsData.extensions.sort(function(a, b) { | 173 extensionsData.extensions.sort(function(a, b) { |
160 if (a.order == b.order) { | 174 if (a.order == b.order) { |
161 a = a.name.toLowerCase(); | 175 a = a.name.toLowerCase(); |
162 b = b.name.toLowerCase(); | 176 b = b.name.toLowerCase(); |
163 return a < b ? -1 : (a > b ? 1 : 0); | 177 return a < b ? -1 : (a > b ? 1 : 0); |
164 } else { | 178 } else { |
165 return a.order < b.order ? -1 : 1; | 179 return a.order < b.order ? -1 : 1; |
(...skipping 10 matching lines...) Expand all Loading... | |
176 | 190 |
177 var extensionList = $('extension-settings-list'); | 191 var extensionList = $('extension-settings-list'); |
178 ExtensionsList.decorate(extensionList); | 192 ExtensionsList.decorate(extensionList); |
179 } | 193 } |
180 | 194 |
181 // Export | 195 // Export |
182 return { | 196 return { |
183 ExtensionSettings: ExtensionSettings | 197 ExtensionSettings: ExtensionSettings |
184 }; | 198 }; |
185 }); | 199 }); |
OLD | NEW |