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

Side by Side Diff: chrome/browser/resources/chromeos/login/oobe.js

Issue 1965913005: ChromeOS: Implement minumal material design OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inline CSS. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview Out of the box experience flow (OOBE). 6 * @fileoverview Out of the box experience flow (OOBE).
7 * This is the main code for the OOBE WebUI implementation. 7 * This is the main code for the OOBE WebUI implementation.
8 */ 8 */
9 9
10 <include src="login_shared.js"> 10 <include src="login_shared.js">
(...skipping 10 matching lines...) Expand all
21 cr.define('cr.ui.Oobe', function() { 21 cr.define('cr.ui.Oobe', function() {
22 return { 22 return {
23 /** 23 /**
24 * Setups given "select" element using the list and adds callback. 24 * Setups given "select" element using the list and adds callback.
25 * Creates option groups if needed. 25 * Creates option groups if needed.
26 * @param {!Element} select Select object to be updated. 26 * @param {!Element} select Select object to be updated.
27 * @param {!Object} list List of the options to be added. 27 * @param {!Object} list List of the options to be added.
28 * Elements with optionGroupName are considered option group. 28 * Elements with optionGroupName are considered option group.
29 * @param {string} callback Callback name which should be send to Chrome or 29 * @param {string} callback Callback name which should be send to Chrome or
30 * an empty string if the event listener shouldn't be added. 30 * an empty string if the event listener shouldn't be added.
31 *
32 * Note: do not forget to update getSelectedTitle() below if this is
33 * updated!
31 */ 34 */
32 setupSelect: function(select, list, callback) { 35 setupSelect: function(select, list, callback) {
33 select.innerHTML = ''; 36 select.innerHTML = '';
34 var optgroup = select; 37 var optgroup = select;
35 for (var i = 0; i < list.length; ++i) { 38 for (var i = 0; i < list.length; ++i) {
36 var item = list[i]; 39 var item = list[i];
37 if (item.optionGroupName) { 40 if (item.optionGroupName) {
38 optgroup = document.createElement('optgroup'); 41 optgroup = document.createElement('optgroup');
39 optgroup.label = item.optionGroupName; 42 optgroup.label = item.optionGroupName;
40 select.appendChild(optgroup); 43 select.appendChild(optgroup);
(...skipping 13 matching lines...) Expand all
54 var keycodeInterested = [ 57 var keycodeInterested = [
55 9, // Tab 58 9, // Tab
56 13, // Enter 59 13, // Enter
57 27, // Escape 60 27, // Escape
58 ]; 61 ];
59 if (keycodeInterested.indexOf(event.keyCode) >= 0) 62 if (keycodeInterested.indexOf(event.keyCode) >= 0)
60 runCallback(); 63 runCallback();
61 }); 64 });
62 } 65 }
63 }, 66 },
67 /**
jdufault 2016/05/20 18:27:27 nit: newline above here
Alexander Alekseev 2016/05/24 00:38:45 Done.
68 * Returns title of the selected option (see setupSelect() above).
69 * @param {!Object} - the same as in setupSelect() above.
jdufault 2016/05/20 18:27:26 replace "-" with "list".
Alexander Alekseev 2016/05/24 00:38:45 Done.
70 */
71 getSelectedTitle: function(list) {
jdufault 2016/05/20 18:27:26 Do the items in |list| store any interesting data
Alexander Alekseev 2016/05/24 00:38:45 It also contains data to setup input element, but
72 var firstTitle = '';
73 for (var i = 0; i < list.length; ++i) {
74 var item = list[i];
75 if (item.optionGroupName)
76 continue;
77
78 if (!firstTitle)
79 firstTitle = item.title;
80
81 if (item.selected)
82 return item.title;
83 }
84 return firstTitle;
85 },
64 86
65 /** 87 /**
66 * Initializes the OOBE flow. This will cause all C++ handlers to 88 * Initializes the OOBE flow. This will cause all C++ handlers to
67 * be invoked to do final setup. 89 * be invoked to do final setup.
68 */ 90 */
69 initialize: function() { 91 initialize: function() {
70 cr.ui.login.DisplayManager.initialize(); 92 cr.ui.login.DisplayManager.initialize();
71 login.HIDDetectionScreen.register(); 93 login.HIDDetectionScreen.register();
72 login.WrongHWIDScreen.register(); 94 login.WrongHWIDScreen.register();
73 login.NetworkScreen.register(); 95 login.NetworkScreen.register();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 reloadContent: function(data) { 296 reloadContent: function(data) {
275 // Reload global local strings, process DOM tree again. 297 // Reload global local strings, process DOM tree again.
276 loadTimeData.overrideValues(data); 298 loadTimeData.overrideValues(data);
277 i18nTemplate.process(document, loadTimeData); 299 i18nTemplate.process(document, loadTimeData);
278 300
279 // Update language and input method menu lists. 301 // Update language and input method menu lists.
280 Oobe.setupSelect($('language-select'), data.languageList); 302 Oobe.setupSelect($('language-select'), data.languageList);
281 Oobe.setupSelect($('keyboard-select'), data.inputMethodsList); 303 Oobe.setupSelect($('keyboard-select'), data.inputMethodsList);
282 Oobe.setupSelect($('timezone-select'), data.timezoneList); 304 Oobe.setupSelect($('timezone-select'), data.timezoneList);
283 305
306 // ---------- Welcome screen
307 $('oobe-welcome-md').currentLanguage =
308 Oobe.getSelectedTitle(data.languageList);
309
310 if (data.newOobeUI == 'on') {
311 $('oobe-connect').hidden = true;
312 $('oobe-welcome-md').hidden = false;
313 } else {
314 $('oobe-connect').hidden = false;
315 $('oobe-welcome-md').hidden = true;
316 }
317 // ----------
318
284 // Update localized content of the screens. 319 // Update localized content of the screens.
285 Oobe.updateLocalizedContent(); 320 Oobe.updateLocalizedContent();
286 }, 321 },
287 322
288 /** 323 /**
289 * Updates localized content of the screens. 324 * Updates localized content of the screens.
290 * Should be executed on language change. 325 * Should be executed on language change.
291 */ 326 */
292 updateLocalizedContent: function() { 327 updateLocalizedContent: function() {
293 // Buttons, headers and links. 328 // Buttons, headers and links.
294 Oobe.getInstance().updateLocalizedContent_(); 329 Oobe.getInstance().updateLocalizedContent_();
295 } 330 }
296 }; 331 };
297 }); 332 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698