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

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: 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 /**
68 * Returns title of the selected option (see setupSelect() above).
69 * @param {!Object} - the same as in setupSelect() above.
70 */
71 getSelectedTitle: function(list) {
72 var firstTitle;
jdufault 2016/05/11 22:07:43 Initialize to '', and then after the for loop unco
Alexander Alekseev 2016/05/13 20:52:34 Done.
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 if (firstTitle)
85 return firstTitle;
86
87 return '';
88 },
64 89
65 /** 90 /**
66 * Initializes the OOBE flow. This will cause all C++ handlers to 91 * Initializes the OOBE flow. This will cause all C++ handlers to
67 * be invoked to do final setup. 92 * be invoked to do final setup.
68 */ 93 */
69 initialize: function() { 94 initialize: function() {
70 cr.ui.login.DisplayManager.initialize(); 95 cr.ui.login.DisplayManager.initialize();
71 login.HIDDetectionScreen.register(); 96 login.HIDDetectionScreen.register();
72 login.WrongHWIDScreen.register(); 97 login.WrongHWIDScreen.register();
73 login.NetworkScreen.register(); 98 login.NetworkScreen.register();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 reloadContent: function(data) { 299 reloadContent: function(data) {
275 // Reload global local strings, process DOM tree again. 300 // Reload global local strings, process DOM tree again.
276 loadTimeData.overrideValues(data); 301 loadTimeData.overrideValues(data);
277 i18nTemplate.process(document, loadTimeData); 302 i18nTemplate.process(document, loadTimeData);
278 303
279 // Update language and input method menu lists. 304 // Update language and input method menu lists.
280 Oobe.setupSelect($('language-select'), data.languageList); 305 Oobe.setupSelect($('language-select'), data.languageList);
281 Oobe.setupSelect($('keyboard-select'), data.inputMethodsList); 306 Oobe.setupSelect($('keyboard-select'), data.inputMethodsList);
282 Oobe.setupSelect($('timezone-select'), data.timezoneList); 307 Oobe.setupSelect($('timezone-select'), data.timezoneList);
283 308
309 // ---------- Welcome screen
310 $('oobe-poly-welcome').SetOobePolyWelcomeCurrentLanguage(
jdufault 2016/05/11 22:07:43 Rename method call to SetCurrentLanguage? What abo
jdufault 2016/05/11 22:07:43 What about oobe-welcome-md?
Alexander Alekseev 2016/05/13 20:52:34 Done.
311 Oobe.getSelectedTitle(data.languageList));
312 if (data.mdOobeUI == 'on') {
313 $('oobe-classic-connect').hidden = true;
jdufault 2016/05/11 22:07:43 Just oobe-connect?
Alexander Alekseev 2016/05/13 20:52:34 Done.
314 $('oobe-poly-welcome').hidden = false;
315 } else {
316 $('oobe-classic-connect').hidden = false;
317 $('oobe-poly-welcome').hidden = true;
318 }
319 // ----------
320
284 // Update localized content of the screens. 321 // Update localized content of the screens.
285 Oobe.updateLocalizedContent(); 322 Oobe.updateLocalizedContent();
286 }, 323 },
287 324
288 /** 325 /**
289 * Updates localized content of the screens. 326 * Updates localized content of the screens.
290 * Should be executed on language change. 327 * Should be executed on language change.
291 */ 328 */
292 updateLocalizedContent: function() { 329 updateLocalizedContent: function() {
293 // Buttons, headers and links. 330 // Buttons, headers and links.
294 Oobe.getInstance().updateLocalizedContent_(); 331 Oobe.getInstance().updateLocalizedContent_();
295 } 332 }
296 }; 333 };
297 }); 334 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698