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