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 } | |
166 | |
167 $('extension-settings-header').innerText = extensionSettingsHeader; | |
168 | |
169 if (extensionsData.extensions.length > 0) { | 156 if (extensionsData.extensions.length > 0) { |
170 // Enforce order specified in the data or (if equal) then sort by | 157 // Enforce order specified in the data or (if equal) then sort by |
171 // extension name (case-insensitive). | 158 // extension name (case-insensitive). |
172 extensionsData.extensions.sort(function(a, b) { | 159 extensionsData.extensions.sort(function(a, b) { |
173 if (a.order == b.order) { | 160 if (a.order == b.order) { |
174 a = a.name.toLowerCase(); | 161 a = a.name.toLowerCase(); |
175 b = b.name.toLowerCase(); | 162 b = b.name.toLowerCase(); |
176 return a < b ? -1 : (a > b ? 1 : 0); | 163 return a < b ? -1 : (a > b ? 1 : 0); |
177 } else { | 164 } else { |
178 return a.order < b.order ? -1 : 1; | 165 return a.order < b.order ? -1 : 1; |
(...skipping 10 matching lines...) Expand all Loading... |
189 | 176 |
190 var extensionList = $('extension-settings-list'); | 177 var extensionList = $('extension-settings-list'); |
191 ExtensionsList.decorate(extensionList); | 178 ExtensionsList.decorate(extensionList); |
192 } | 179 } |
193 | 180 |
194 // Export | 181 // Export |
195 return { | 182 return { |
196 ExtensionSettings: ExtensionSettings | 183 ExtensionSettings: ExtensionSettings |
197 }; | 184 }; |
198 }); | 185 }); |
OLD | NEW |