OLD | NEW |
---|---|
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', |
(...skipping 14 matching lines...) Expand all Loading... | |
25 type: String, | 25 type: String, |
26 value: '', | 26 value: '', |
27 }, | 27 }, |
28 | 28 |
29 /** | 29 /** |
30 * List of languages for language selector dropdown. | 30 * List of languages for language selector dropdown. |
31 * @type {!Array<OobeTypes.LanguageDsc>} | 31 * @type {!Array<OobeTypes.LanguageDsc>} |
32 */ | 32 */ |
33 languages: { | 33 languages: { |
34 type: Array, | 34 type: Array, |
35 observer: "onLanguagesChanged_", | 35 observer: 'onLanguagesChanged_', |
36 }, | 36 }, |
37 | 37 |
38 /** | 38 /** |
39 * List of keyboards for keyboard selector dropdown. | 39 * List of keyboards for keyboard selector dropdown. |
40 * @type {!Array<OobeTypes.IMEDsc>} | 40 * @type {!Array<OobeTypes.IMEDsc>} |
41 */ | 41 */ |
42 keyboards: { | 42 keyboards: { |
43 type: Array, | 43 type: Array, |
44 observer: "onKeyboardsChanged_", | 44 observer: 'onKeyboardsChanged_', |
45 }, | 45 }, |
46 | 46 |
47 /** | 47 /** |
48 * Flag that enables MD-OOBE. | 48 * Flag that enables MD-OOBE. |
49 */ | 49 */ |
50 enabled: { | 50 enabled: { |
51 type: Boolean, | 51 type: Boolean, |
52 value: false, | 52 value: false, |
53 }, | 53 }, |
54 | 54 |
(...skipping 15 matching lines...) Expand all Loading... | |
70 }, | 70 }, |
71 | 71 |
72 /** | 72 /** |
73 * If UI uses forced keyboard navigation. | 73 * If UI uses forced keyboard navigation. |
74 */ | 74 */ |
75 highlightStrength: { | 75 highlightStrength: { |
76 type: String, | 76 type: String, |
77 value: '', | 77 value: '', |
78 }, | 78 }, |
79 | 79 |
80 /* | |
81 * Dynamically change languages. | |
82 * @private | |
83 */ | |
84 i18n_: Object, | |
85 | |
80 /** | 86 /** |
81 * True when connected to a network. | 87 * True when connected to a network. |
82 * @private | 88 * @private |
83 */ | 89 */ |
84 isConnected_: { | 90 isConnected_: { |
85 type: Boolean, | 91 type: Boolean, |
86 value: false, | 92 value: false, |
87 }, | 93 }, |
88 | 94 |
89 /** | 95 /** |
90 * Controls displaying of "Enable debugging features" link. | 96 * Controls displaying of "Enable debugging features" link. |
91 */ | 97 */ |
92 debuggingLinkVisible: Boolean, | 98 debuggingLinkVisible: Boolean, |
93 }, | 99 }, |
94 | 100 |
95 /** | 101 /** |
96 * GUID of the user-selected network. It is remembered after user taps on | 102 * GUID of the user-selected network. It is remembered after user taps on |
97 * network entry. After we receive event "connected" on this network, | 103 * network entry. After we receive event "connected" on this network, |
98 * OOBE will proceed. | 104 * OOBE will proceed. |
99 */ | 105 */ |
100 networkLastSelectedGuid_: '', | 106 networkLastSelectedGuid_: '', |
101 | 107 |
102 /** @override */ | 108 /** @override */ |
(...skipping 20 matching lines...) Expand all Loading... | |
123 networkListItemNotConnected: | 129 networkListItemNotConnected: |
124 loadTimeData.getString('networkListItemNotConnected'), | 130 loadTimeData.getString('networkListItemNotConnected'), |
125 vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'), | 131 vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'), |
126 | 132 |
127 // Additional strings for custom items. | 133 // Additional strings for custom items. |
128 addMobileNetworkMenuName: | 134 addMobileNetworkMenuName: |
129 loadTimeData.getString('addMobileNetworkMenuName'), | 135 loadTimeData.getString('addMobileNetworkMenuName'), |
130 addWiFiNetworkMenuName: loadTimeData.getString('addWiFiNetworkMenuName'), | 136 addWiFiNetworkMenuName: loadTimeData.getString('addWiFiNetworkMenuName'), |
131 proxySettingsMenuName: loadTimeData.getString('proxySettingsMenuName'), | 137 proxySettingsMenuName: loadTimeData.getString('proxySettingsMenuName'), |
132 }; | 138 }; |
139 | |
140 // I18n tags in this list are updated in the i18n_ object to reflect the | |
141 // current i18n locale selected by the user. | |
142 var i18nTags = [ | |
143 'accessibilitySectionHint', 'accessibilitySectionTitle', | |
144 'highContrastOption', 'highContrastOptionOff', | |
145 'highContrastOptionOn', 'keyboardDropdownTitle', | |
146 'languageDropdownTitle', 'languageSectionTitle', | |
147 'largeCursorOption', 'largeCursorOptionOff', | |
148 'largeCursorOptionOn', 'networkSectionHint', | |
149 'networkSectionTitle', 'oobeOKButtonText', | |
150 'screenMagnifierOption', 'screenMagnifierOptionOff', | |
151 'screenMagnifierOptionOn', 'spokenFeedbackOption', | |
152 'spokenFeedbackOptionOff', 'spokenFeedbackOptionOn', | |
153 'timezoneDropdownTitle', 'timezoneSectionTitle', | |
154 'virtualKeyboardOption', 'virtualKeyboardOptionOff', | |
155 'virtualKeyboardOptionOn', | |
156 ]; | |
157 var i18n = {}; | |
158 i18nTags.forEach(function(tag) { | |
159 i18n[tag] = loadTimeData.getString(tag); | |
160 }); | |
161 this.i18n_ = i18n; | |
Alexander Alekseev
2017/05/19 23:57:29
Is this an example of what could be done, or a fin
dschuyler
2017/05/20 00:04:56
I see it as working, potentially final code. I'm g
dschuyler
2017/05/20 00:26:43
dbeam@ suggested an improvement that may eliminate
dschuyler
2017/05/20 00:56:09
WDYT of patch #3
| |
133 }, | 162 }, |
134 | 163 |
135 /** | 164 /** |
136 * Hides all screens to help switching from one screen to another. | 165 * Hides all screens to help switching from one screen to another. |
137 * @private | 166 * @private |
138 */ | 167 */ |
139 hideAllScreens_: function() { | 168 hideAllScreens_: function() { |
140 this.$.welcomeScreen.hidden = true; | 169 this.$.welcomeScreen.hidden = true; |
141 | 170 |
142 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog') | 171 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog'); |
143 for (var i = 0; i < screens.length; ++i) { | 172 for (var i = 0; i < screens.length; ++i) { |
144 screens[i].hidden = true; | 173 screens[i].hidden = true; |
145 } | 174 } |
146 }, | 175 }, |
147 | 176 |
148 /** | 177 /** |
149 * Shows given screen. | 178 * Shows given screen. |
150 * @param id String Screen ID. | 179 * @param id String Screen ID. |
151 * @private | 180 * @private |
152 */ | 181 */ |
153 showScreen_: function(id) { | 182 showScreen_: function(id) { |
154 this.hideAllScreens_(); | 183 this.hideAllScreens_(); |
155 | 184 |
156 var screen = this.$[id]; | 185 var screen = this.$[id]; |
157 assert(screen); | 186 assert(screen); |
158 screen.hidden = false; | 187 screen.hidden = false; |
159 screen.show(); | 188 screen.show(); |
160 }, | 189 }, |
161 | 190 |
162 /** | 191 /** |
163 * Returns active screen object. | 192 * Returns active screen object. |
164 * @private | 193 * @private |
165 */ | 194 */ |
166 getActiveScreen_: function() { | 195 getActiveScreen_: function() { |
167 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog') | 196 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog'); |
168 for (var i = 0; i < screens.length; ++i) { | 197 for (var i = 0; i < screens.length; ++i) { |
169 if (!screens[i].hidden) | 198 if (!screens[i].hidden) |
170 return screens[i]; | 199 return screens[i]; |
171 } | 200 } |
172 return this.$.welcomeScreen; | 201 return this.$.welcomeScreen; |
173 }, | 202 }, |
174 | 203 |
175 focus: function() { | 204 focus: function() { |
176 this.getActiveScreen_().focus(); | 205 this.getActiveScreen_().focus(); |
177 }, | 206 }, |
(...skipping 22 matching lines...) Expand all Loading... | |
200 * when connected to a network. | 229 * when connected to a network. |
201 * @private | 230 * @private |
202 */ | 231 */ |
203 getNetworkCustomItems_: function(isConnected_) { | 232 getNetworkCustomItems_: function(isConnected_) { |
204 var self = this; | 233 var self = this; |
205 var items = [ | 234 var items = [ |
206 { | 235 { |
207 customItemName: 'proxySettingsMenuName', | 236 customItemName: 'proxySettingsMenuName', |
208 polymerIcon: 'oobe-welcome-20:add-proxy', | 237 polymerIcon: 'oobe-welcome-20:add-proxy', |
209 customData: { | 238 customData: { |
210 onTap: function() { self.OpenProxySettingsDialog_(); }, | 239 onTap: function() { |
240 self.OpenProxySettingsDialog_(); | |
241 }, | |
211 }, | 242 }, |
212 }, | 243 }, |
213 { | 244 { |
214 customItemName: 'addWiFiNetworkMenuName', | 245 customItemName: 'addWiFiNetworkMenuName', |
215 polymerIcon: 'oobe-welcome-20:add-wifi', | 246 polymerIcon: 'oobe-welcome-20:add-wifi', |
216 customData: { | 247 customData: { |
217 onTap: function() { self.OpenAddWiFiNetworkDialog_(); }, | 248 onTap: function() { |
249 self.OpenAddWiFiNetworkDialog_(); | |
250 }, | |
218 }, | 251 }, |
219 }, | 252 }, |
220 { | 253 { |
221 customItemName: 'addMobileNetworkMenuName', | 254 customItemName: 'addMobileNetworkMenuName', |
222 polymerIcon: 'oobe-welcome-20:add-cellular', | 255 polymerIcon: 'oobe-welcome-20:add-cellular', |
223 customData: { | 256 customData: { |
224 onTap: function() { self.OpenAddWiFiNetworkDialog_(); }, | 257 onTap: function() { |
258 self.OpenAddWiFiNetworkDialog_(); | |
259 }, | |
225 }, | 260 }, |
226 }, | 261 }, |
227 ]; | 262 ]; |
228 if (isConnected_) | 263 if (isConnected_) |
229 return items; | 264 return items; |
230 return items.slice(1); | 265 return items.slice(1); |
231 }, | 266 }, |
232 | 267 |
233 /** | 268 /** |
234 * Returns true if timezone button should be visible. | 269 * Returns true if timezone button should be visible. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 /** | 303 /** |
269 * Handle "Timezone" button for "Welcome" screen. | 304 * Handle "Timezone" button for "Welcome" screen. |
270 * | 305 * |
271 * @private | 306 * @private |
272 */ | 307 */ |
273 onWelcomeTimezoneButtonClicked_: function() { | 308 onWelcomeTimezoneButtonClicked_: function() { |
274 this.showScreen_('timezoneScreen'); | 309 this.showScreen_('timezoneScreen'); |
275 }, | 310 }, |
276 | 311 |
277 /** | 312 /** |
278 * Handle Networwork Setup screen "Proxy settings" button. | 313 * Handle Network Setup screen "Proxy settings" button. |
279 * | 314 * |
280 * @private | 315 * @private |
281 */ | 316 */ |
282 OpenProxySettingsDialog_: function(item) { | 317 OpenProxySettingsDialog_: function(item) { |
283 chrome.send('launchProxySettingsDialog'); | 318 chrome.send('launchProxySettingsDialog'); |
284 }, | 319 }, |
285 | 320 |
286 /** | 321 /** |
287 * Handle Networwork Setup screen "Add WiFi network" button. | 322 * Handle Network Setup screen "Add WiFi network" button. |
288 * | 323 * |
289 * @private | 324 * @private |
290 */ | 325 */ |
291 OpenAddWiFiNetworkDialog_: function(item) { | 326 OpenAddWiFiNetworkDialog_: function(item) { |
292 chrome.send('launchAddWiFiNetworkDialog'); | 327 chrome.send('launchAddWiFiNetworkDialog'); |
293 }, | 328 }, |
294 | 329 |
295 /** | 330 /** |
296 * Handle Networwork Setup screen "Add cellular network" button. | 331 * Handle Network Setup screen "Add cellular network" button. |
297 * | 332 * |
298 * @private | 333 * @private |
299 */ | 334 */ |
300 OpenAddMobileNetworkDialog_: function(item) { | 335 OpenAddMobileNetworkDialog_: function(item) { |
301 chrome.send('launchAddMobileNetworkDialog'); | 336 chrome.send('launchAddMobileNetworkDialog'); |
302 }, | 337 }, |
303 | 338 |
304 /** | 339 /** |
305 * This is called when network setup is done. | 340 * This is called when network setup is done. |
306 * | 341 * |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 * @private | 522 * @private |
488 */ | 523 */ |
489 onTimezoneSelected_: function(event) { | 524 onTimezoneSelected_: function(event) { |
490 var item = event.detail; | 525 var item = event.detail; |
491 if (!item) | 526 if (!item) |
492 return; | 527 return; |
493 | 528 |
494 this.screen.onTimezoneSelected_(item.value); | 529 this.screen.onTimezoneSelected_(item.value); |
495 }, | 530 }, |
496 }); | 531 }); |
OLD | NEW |