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

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

Issue 2189733006: ChromeOS: Implement Language Selection screen of material design OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use translatable string for OK button text Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Polymer element for displaying material design OOBE. 6 * @fileoverview Polymer element for displaying material design OOBE.
7 */ 7 */
8 8
9 Polymer({ 9 Polymer({
10 is: 'oobe-welcome-md', 10 is: 'oobe-welcome-md',
11 11
12 properties: { 12 properties: {
13 /** 13 /**
14 * Currently selected system language. 14 * Currently selected system language (display name).
15 */ 15 */
16 currentLanguage: { 16 currentLanguage: {
17 type: String, 17 type: String,
18 value: 'English (US)', 18 value: null,
michaelpg 2016/07/29 06:26:50 a nullable string is weird... what about '' or und
stevenjb 2016/07/29 16:11:52 Generally undefined would be preferred if used in
Alexander Alekseev 2016/08/01 22:21:43 Done.
19 }, 19 },
20 20
21 /** 21 /**
22 * Flag that switches Welcome screen to Network Selection screen. 22 * List of languages for language selector dropdown.
23 */
24 oobeLanguages: {
michaelpg 2016/07/29 06:26:50 nit: why not just "languages"?
Alexander Alekseev 2016/08/01 22:21:43 Done.
25 type: Array,
stevenjb 2016/07/29 16:11:52 @type these arrays.
Alexander Alekseev 2016/08/01 22:21:43 Done.
26 value: null,
27 },
28
29 /**
30 * List of keyboards for keyboard selector dropdown.
31 */
32 oobeKeyboards: {
michaelpg 2016/07/29 06:26:50 same: "keyboards"?
Alexander Alekseev 2016/08/01 22:21:43 Done.
33 type: Array,
34 value: null,
35 },
36
37 /**
38 * Flag that shows Welcome screen.
39 */
40 welcomeScreenShown: {
41 type: Boolean,
42 value: true,
43 },
44
45 /**
46 * Flag that shows Language Selection screen.
47 */
48 languageSelectionScreenShown: {
49 type: Boolean,
50 value: false,
51 },
52
53 /**
54 * Flag that shows Network Selection screen.
23 */ 55 */
24 networkSelectionScreenShown: { 56 networkSelectionScreenShown: {
25 type: Boolean, 57 type: Boolean,
26 value: false, 58 value: false,
27 }, 59 },
28 }, 60 },
29 61
30 /** 62 /**
63 * Hides all screens to help switching from one screen to another.
64 */
65 hideAllScreens_: function() {
66 this.welcomeScreenShown = false;
67 this.networkSelectionScreenShown = false;
68 this.languageSelectionScreenShown = false;
69 },
70
71 /**
31 * GUID of the user-selected network. It is remembered after user taps on 72 * GUID of the user-selected network. It is remembered after user taps on
32 * network entry. After we receive event "connected" on this network, 73 * network entry. After we receive event "connected" on this network,
33 * OOBE will proceed. 74 * OOBE will proceed.
34 */ 75 */
35 networkLastSelectedGuid_: '', 76 networkLastSelectedGuid_: '',
36 77
37 /** 78 /**
38 * Sets proper focus. 79 * Sets proper focus.
39 */ 80 */
40 focus: function() { 81 focus: function() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 }, 119 },
79 ]; 120 ];
80 }, 121 },
81 122
82 /** 123 /**
83 * Handle "Next" button for "Welcome" screen. 124 * Handle "Next" button for "Welcome" screen.
84 * 125 *
85 * @private 126 * @private
86 */ 127 */
87 onWelcomeNextButtonClicked_: function() { 128 onWelcomeNextButtonClicked_: function() {
129 this.hideAllScreens_();
88 this.networkSelectionScreenShown = true; 130 this.networkSelectionScreenShown = true;
89 }, 131 },
90 132
91 /** 133 /**
134 * Handle "Language" button for "Welcome" screen.
135 *
136 * @private
137 */
138 onWelcomeSelectLanguageButtonClicked_: function() {
139 this.hideAllScreens_();
140 this.languageSelectionScreenShown = true;
141 },
142
143 /**
92 * Handle Networwork Setup screen "Proxy settings" button. 144 * Handle Networwork Setup screen "Proxy settings" button.
93 * 145 *
94 * @private 146 * @private
95 */ 147 */
96 OpenProxySettingsDialog_: function(item) { 148 OpenProxySettingsDialog_: function(item) {
97 chrome.send('launchProxySettingsDialog'); 149 chrome.send('launchProxySettingsDialog');
98 }, 150 },
99 151
100 /** 152 /**
101 * Handle Networwork Setup screen "Add WiFi network" button. 153 * Handle Networwork Setup screen "Add WiFi network" button.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 }); 230 });
179 }, 231 },
180 232
181 /** 233 /**
182 * @param {!Event} event 234 * @param {!Event} event
183 */ 235 */
184 onNetworkListCustomItemSelected_: function(e) { 236 onNetworkListCustomItemSelected_: function(e) {
185 var itemState = e.detail; 237 var itemState = e.detail;
186 itemState.customData.onTap(); 238 itemState.customData.onTap();
187 }, 239 },
240
241 onLanguageSelected_: function(event) {
michaelpg 2016/07/29 06:26:50 @param {!Event} event, @private
stevenjb 2016/07/29 16:11:52 Even better, '{!{detail: {!ItemType}}} event' (her
Alexander Alekseev 2016/08/01 22:21:43 Done.
242 var item = event.detail;
243 if (!item)
244 return;
245
246 var languageId = item.value;
247 this.screen.onLanguageSelected_(languageId);
248 },
249
250 onKeyboardSelected_: function(event) {
michaelpg 2016/07/29 06:26:50 @param {!Event} event, @private
Alexander Alekseev 2016/08/01 22:21:43 Done.
251 var item = event.detail;
252 if (!item)
253 return;
254
255 var inputMethodId = item.value;
256 this.screen.onKeyboardSelected_(inputMethodId);
257 },
258
259 /**
260 * Handle "OK" button for "LanguageSelection" screen.
261 *
262 * @private
263 */
264 closeLanguageSection_: function() {
265 this.hideAllScreens_();
266 this.welcomeScreenShown = true;
267 },
268
269 /**
270 * TODO(stevenjb): Replace getText with a proper localization function that
271 * handles string substitution.
272 * Performs argument substitution, replacing $1, $2, etc in 'text' with
273 * corresponding entries in |args|.
274 * @param {string} text The string to perform the substitution on.
275 * @param {?Array<string>=} opt_args The arguments to replace $1, $2, etc
276 * with.
277 */
stevenjb 2016/07/29 16:11:52 We should either convert login/oobe to use the i18
Alexander Alekseev 2016/08/01 22:21:43 Done.
278 getText_: function(text, opt_args) {
279 var res;
280 if (loadTimeData && loadTimeData.data_)
281 res = loadTimeData.getString(text) || text;
282 else
283 res = text;
284 if (!opt_args)
285 return res;
286 for (let i = 0; i < opt_args.length; ++i) {
287 let key = '$' + (i + 1);
288 res = res.replace(key, opt_args[i]);
289 }
290 return res;
291 },
188 }); 292 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698