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 | |
Finnur
2011/09/19 13:49:56
nit: Space is on the wrong side of the period.
| |
158 // then display Title as Extensions only. | |
Finnur
2011/09/19 13:49:56
nit: Title should not be capitalized.
Actually, t
| |
159 $('extension-settings-header').style.visibility = 'visible'; | |
160 $('dev-toggle').style.visibility = 'visible'; | |
161 var extensionSettingHeader; | |
162 if(extensionsData.extensions.length > 0) { | |
Finnur
2011/09/19 13:49:56
style: Space after 'if' (before parentheses).
| |
163 extensionSettingsHeader = templateData.extensionSettingsTitle | |
164 + " (" | |
165 + extensionsData.extensions.length | |
166 + ")"; | |
Finnur
2011/09/19 13:49:56
style: When you need to break long lines into mult
| |
167 } | |
168 else | |
Finnur
2011/09/19 13:49:56
style: I believe if the 'if' clause has braces, th
| |
169 extensionSettingsHeader = templateData.extensionSettingsTitle; | |
170 | |
171 $('extension-settings-header').innerHTML = extensionSettingsHeader; | |
Finnur
2011/09/19 13:49:56
use innerText, not innerHTML.
naveenbobbili
2011/09/19 14:43:18
Sure. I will take a look at the styling guide line
| |
172 | |
156 if (extensionsData.extensions.length > 0) { | 173 if (extensionsData.extensions.length > 0) { |
157 // Enforce order specified in the data or (if equal) then sort by | 174 // Enforce order specified in the data or (if equal) then sort by |
158 // extension name (case-insensitive). | 175 // extension name (case-insensitive). |
159 extensionsData.extensions.sort(function(a, b) { | 176 extensionsData.extensions.sort(function(a, b) { |
160 if (a.order == b.order) { | 177 if (a.order == b.order) { |
161 a = a.name.toLowerCase(); | 178 a = a.name.toLowerCase(); |
162 b = b.name.toLowerCase(); | 179 b = b.name.toLowerCase(); |
163 return a < b ? -1 : (a > b ? 1 : 0); | 180 return a < b ? -1 : (a > b ? 1 : 0); |
164 } else { | 181 } else { |
165 return a.order < b.order ? -1 : 1; | 182 return a.order < b.order ? -1 : 1; |
(...skipping 10 matching lines...) Expand all Loading... | |
176 | 193 |
177 var extensionList = $('extension-settings-list'); | 194 var extensionList = $('extension-settings-list'); |
178 ExtensionsList.decorate(extensionList); | 195 ExtensionsList.decorate(extensionList); |
179 } | 196 } |
180 | 197 |
181 // Export | 198 // Export |
182 return { | 199 return { |
183 ExtensionSettings: ExtensionSettings | 200 ExtensionSettings: ExtensionSettings |
184 }; | 201 }; |
185 }); | 202 }); |
OLD | NEW |