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

Unified Diff: chrome/browser/resources/chromeos/login/oobe.js

Issue 144363006: Expand VPD initial_locale to a list of locales. Use the expanded VPD initial_locale on the OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After-review. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/login/oobe.js
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js
index db990d85a74634adfa513b850a04dd1aff4cb633..3cbc2a5056b29beaf251cfa5a78b910a9f317b30 100644
--- a/chrome/browser/resources/chromeos/login/oobe.js
+++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -16,18 +16,27 @@ cr.define('cr.ui.Oobe', function() {
return {
/**
* Setups given "select" element using the list and adds callback.
+ * Creates option groups if needed.
* @param {!Element} select Select object to be updated.
* @param {!Object} list List of the options to be added.
+ * Elements with optionGroupName are considered option group.
* @param {string} callback Callback name which should be send to Chrome or
* an empty string if the event listener shouldn't be added.
*/
setupSelect: function(select, list, callback) {
- select.options.length = 0;
+ select.innerHTML = '';
+ var optgroup = select;
for (var i = 0; i < list.length; ++i) {
var item = list[i];
- var option =
- new Option(item.title, item.value, item.selected, item.selected);
- select.appendChild(option);
+ if (item.optionGroupName) {
+ optgroup = document.createElement('optgroup');
+ optgroup.label = item.optionGroupName;
+ select.appendChild(optgroup);
+ } else {
+ var option =
+ new Option(item.title, item.value, item.selected, item.selected);
+ optgroup.appendChild(option);
+ }
}
if (callback) {
var sendCallback = function() {

Powered by Google App Engine
This is Rietveld 408576698