Chromium Code Reviews| 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_: { | |
| 85 type: Object, | |
| 86 value: function() { | |
| 87 return {}; | |
|
Dan Beam
2017/05/18 00:04:57
set this only when ready, IMO
dschuyler
2017/05/18 00:46:57
Done.
| |
| 88 }, | |
| 89 }, | |
| 90 | |
| 80 /** | 91 /** |
| 81 * True when connected to a network. | 92 * True when connected to a network. |
| 82 * @private | 93 * @private |
| 83 */ | 94 */ |
| 84 isConnected_: { | 95 isConnected_: { |
| 85 type: Boolean, | 96 type: Boolean, |
| 86 value: false, | 97 value: false, |
| 87 }, | 98 }, |
| 88 | 99 |
| 89 /** | 100 /** |
| 90 * Controls displaying of "Enable debugging features" link. | 101 * Controls displaying of "Enable debugging features" link. |
| 91 */ | 102 */ |
| 92 debuggingLinkVisible: Boolean, | 103 debuggingLinkVisible: Boolean, |
| 93 }, | 104 }, |
| 94 | 105 |
| 95 /** | 106 /** |
| 96 * GUID of the user-selected network. It is remembered after user taps on | 107 * GUID of the user-selected network. It is remembered after user taps on |
| 97 * network entry. After we receive event "connected" on this network, | 108 * network entry. After we receive event "connected" on this network, |
| 98 * OOBE will proceed. | 109 * OOBE will proceed. |
| 99 */ | 110 */ |
| 100 networkLastSelectedGuid_: '', | 111 networkLastSelectedGuid_: '', |
| 101 | 112 |
| 102 /** @override */ | 113 /** @override */ |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 123 networkListItemNotConnected: | 134 networkListItemNotConnected: |
| 124 loadTimeData.getString('networkListItemNotConnected'), | 135 loadTimeData.getString('networkListItemNotConnected'), |
| 125 vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'), | 136 vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'), |
| 126 | 137 |
| 127 // Additional strings for custom items. | 138 // Additional strings for custom items. |
| 128 addMobileNetworkMenuName: | 139 addMobileNetworkMenuName: |
| 129 loadTimeData.getString('addMobileNetworkMenuName'), | 140 loadTimeData.getString('addMobileNetworkMenuName'), |
| 130 addWiFiNetworkMenuName: loadTimeData.getString('addWiFiNetworkMenuName'), | 141 addWiFiNetworkMenuName: loadTimeData.getString('addWiFiNetworkMenuName'), |
| 131 proxySettingsMenuName: loadTimeData.getString('proxySettingsMenuName'), | 142 proxySettingsMenuName: loadTimeData.getString('proxySettingsMenuName'), |
| 132 }; | 143 }; |
| 144 | |
| 145 // I18n tags in this list are updated in the i18n_ object to reflect the | |
| 146 // current i18n locale selected by the user. | |
| 147 var i18nTags = [ | |
| 148 'accessibilitySectionHint', 'accessibilitySectionTitle', | |
| 149 'highContrastOption', 'highContrastOptionOff', | |
| 150 'highContrastOptionOn', 'keyboardDropdownTitle', | |
| 151 'languageDropdownTitle', 'languageSectionTitle', | |
| 152 'largeCursorOption', 'largeCursorOptionOff', | |
| 153 'largeCursorOptionOn', 'networkSectionHint', | |
| 154 'networkSectionTitle', 'oobeOKButtonText', | |
| 155 'screenMagnifierOption', 'screenMagnifierOptionOff', | |
| 156 'screenMagnifierOptionOn', 'spokenFeedbackOption', | |
| 157 'spokenFeedbackOptionOff', 'spokenFeedbackOptionOn', | |
| 158 'timezoneDropdownTitle', 'timezoneSectionTitle', | |
| 159 'virtualKeyboardOption', 'virtualKeyboardOptionOff', | |
| 160 'virtualKeyboardOptionOn', | |
| 161 ]; | |
|
Dan Beam
2017/05/18 00:04:57
var i18n = {};
i18nTags.forEach(function(tag) {
dschuyler
2017/05/18 00:46:57
Done.
| |
| 162 for (var i in i18nTags) | |
| 163 this.set('i18n_.' + i18nTags[i], loadTimeData.getString(i18nTags[i])); | |
| 133 }, | 164 }, |
| 134 | 165 |
| 135 /** | 166 /** |
| 136 * Hides all screens to help switching from one screen to another. | 167 * Hides all screens to help switching from one screen to another. |
| 137 * @private | 168 * @private |
| 138 */ | 169 */ |
| 139 hideAllScreens_: function() { | 170 hideAllScreens_: function() { |
| 140 this.$.welcomeScreen.hidden = true; | 171 this.$.welcomeScreen.hidden = true; |
| 141 | 172 |
| 142 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog') | 173 var screens = Polymer.dom(this.root).querySelectorAll( |
|
Dan Beam
2017/05/18 00:04:57
this line should've ended with a ;
dschuyler
2017/05/18 00:46:57
Done.
| |
| 143 for (var i = 0; i < screens.length; ++i) { | 174 'oobe-dialog') for (var i = 0; i < screens.length; ++i) { |
| 144 screens[i].hidden = true; | 175 screens[i].hidden = true; |
| 145 } | 176 } |
| 146 }, | 177 }, |
| 147 | 178 |
| 148 /** | 179 /** |
| 149 * Shows given screen. | 180 * Shows given screen. |
| 150 * @param id String Screen ID. | 181 * @param id String Screen ID. |
| 151 * @private | 182 * @private |
| 152 */ | 183 */ |
| 153 showScreen_: function(id) { | 184 showScreen_: function(id) { |
| 154 this.hideAllScreens_(); | 185 this.hideAllScreens_(); |
| 155 | 186 |
| 156 var screen = this.$[id]; | 187 var screen = this.$[id]; |
| 157 assert(screen); | 188 assert(screen); |
| 158 screen.hidden = false; | 189 screen.hidden = false; |
| 159 screen.show(); | 190 screen.show(); |
| 160 }, | 191 }, |
| 161 | 192 |
| 162 /** | 193 /** |
| 163 * Returns active screen object. | 194 * Returns active screen object. |
| 164 * @private | 195 * @private |
| 165 */ | 196 */ |
| 166 getActiveScreen_: function() { | 197 getActiveScreen_: function() { |
| 167 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog') | 198 var screens = Polymer.dom(this.root).querySelectorAll( |
|
Dan Beam
2017/05/18 00:04:57
same
dschuyler
2017/05/18 00:46:57
Done.
| |
| 168 for (var i = 0; i < screens.length; ++i) { | 199 'oobe-dialog') for (var i = 0; i < screens.length; ++i) { |
| 169 if (!screens[i].hidden) | 200 if (!screens[i].hidden) |
| 170 return screens[i]; | 201 return screens[i]; |
| 171 } | 202 } |
| 172 return this.$.welcomeScreen; | 203 return this.$.welcomeScreen; |
| 173 }, | 204 }, |
| 174 | 205 |
| 175 focus: function() { | 206 focus: function() { |
| 176 this.getActiveScreen_().focus(); | 207 this.getActiveScreen_().focus(); |
| 177 }, | 208 }, |
| 178 | 209 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 200 * when connected to a network. | 231 * when connected to a network. |
| 201 * @private | 232 * @private |
| 202 */ | 233 */ |
| 203 getNetworkCustomItems_: function(isConnected_) { | 234 getNetworkCustomItems_: function(isConnected_) { |
| 204 var self = this; | 235 var self = this; |
| 205 var items = [ | 236 var items = [ |
| 206 { | 237 { |
| 207 customItemName: 'proxySettingsMenuName', | 238 customItemName: 'proxySettingsMenuName', |
| 208 polymerIcon: 'oobe-welcome-20:add-proxy', | 239 polymerIcon: 'oobe-welcome-20:add-proxy', |
| 209 customData: { | 240 customData: { |
| 210 onTap: function() { self.OpenProxySettingsDialog_(); }, | 241 onTap: function() { |
| 242 self.OpenProxySettingsDialog_(); | |
| 243 }, | |
| 211 }, | 244 }, |
| 212 }, | 245 }, |
| 213 { | 246 { |
| 214 customItemName: 'addWiFiNetworkMenuName', | 247 customItemName: 'addWiFiNetworkMenuName', |
| 215 polymerIcon: 'oobe-welcome-20:add-wifi', | 248 polymerIcon: 'oobe-welcome-20:add-wifi', |
| 216 customData: { | 249 customData: { |
| 217 onTap: function() { self.OpenAddWiFiNetworkDialog_(); }, | 250 onTap: function() { |
| 251 self.OpenAddWiFiNetworkDialog_(); | |
| 252 }, | |
| 218 }, | 253 }, |
| 219 }, | 254 }, |
| 220 { | 255 { |
| 221 customItemName: 'addMobileNetworkMenuName', | 256 customItemName: 'addMobileNetworkMenuName', |
| 222 polymerIcon: 'oobe-welcome-20:add-cellular', | 257 polymerIcon: 'oobe-welcome-20:add-cellular', |
| 223 customData: { | 258 customData: { |
| 224 onTap: function() { self.OpenAddWiFiNetworkDialog_(); }, | 259 onTap: function() { |
| 260 self.OpenAddWiFiNetworkDialog_(); | |
| 261 }, | |
| 225 }, | 262 }, |
| 226 }, | 263 }, |
| 227 ]; | 264 ]; |
| 228 if (isConnected_) | 265 if (isConnected_) |
| 229 return items; | 266 return items; |
| 230 return items.slice(1); | 267 return items.slice(1); |
| 231 }, | 268 }, |
| 232 | 269 |
| 233 /** | 270 /** |
| 234 * Returns true if timezone button should be visible. | 271 * Returns true if timezone button should be visible. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 /** | 305 /** |
| 269 * Handle "Timezone" button for "Welcome" screen. | 306 * Handle "Timezone" button for "Welcome" screen. |
| 270 * | 307 * |
| 271 * @private | 308 * @private |
| 272 */ | 309 */ |
| 273 onWelcomeTimezoneButtonClicked_: function() { | 310 onWelcomeTimezoneButtonClicked_: function() { |
| 274 this.showScreen_('timezoneScreen'); | 311 this.showScreen_('timezoneScreen'); |
| 275 }, | 312 }, |
| 276 | 313 |
| 277 /** | 314 /** |
| 278 * Handle Networwork Setup screen "Proxy settings" button. | 315 * Handle Network Setup screen "Proxy settings" button. |
| 279 * | 316 * |
| 280 * @private | 317 * @private |
| 281 */ | 318 */ |
| 282 OpenProxySettingsDialog_: function(item) { | 319 OpenProxySettingsDialog_: function(item) { |
| 283 chrome.send('launchProxySettingsDialog'); | 320 chrome.send('launchProxySettingsDialog'); |
| 284 }, | 321 }, |
| 285 | 322 |
| 286 /** | 323 /** |
| 287 * Handle Networwork Setup screen "Add WiFi network" button. | 324 * Handle Network Setup screen "Add WiFi network" button. |
| 288 * | 325 * |
| 289 * @private | 326 * @private |
| 290 */ | 327 */ |
| 291 OpenAddWiFiNetworkDialog_: function(item) { | 328 OpenAddWiFiNetworkDialog_: function(item) { |
| 292 chrome.send('launchAddWiFiNetworkDialog'); | 329 chrome.send('launchAddWiFiNetworkDialog'); |
| 293 }, | 330 }, |
| 294 | 331 |
| 295 /** | 332 /** |
| 296 * Handle Networwork Setup screen "Add cellular network" button. | 333 * Handle Network Setup screen "Add cellular network" button. |
| 297 * | 334 * |
| 298 * @private | 335 * @private |
| 299 */ | 336 */ |
| 300 OpenAddMobileNetworkDialog_: function(item) { | 337 OpenAddMobileNetworkDialog_: function(item) { |
| 301 chrome.send('launchAddMobileNetworkDialog'); | 338 chrome.send('launchAddMobileNetworkDialog'); |
| 302 }, | 339 }, |
| 303 | 340 |
| 304 /** | 341 /** |
| 305 * This is called when network setup is done. | 342 * This is called when network setup is done. |
| 306 * | 343 * |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 * @private | 524 * @private |
| 488 */ | 525 */ |
| 489 onTimezoneSelected_: function(event) { | 526 onTimezoneSelected_: function(event) { |
| 490 var item = event.detail; | 527 var item = event.detail; |
| 491 if (!item) | 528 if (!item) |
| 492 return; | 529 return; |
| 493 | 530 |
| 494 this.screen.onTimezoneSelected_(item.value); | 531 this.screen.onTimezoneSelected_(item.value); |
| 495 }, | 532 }, |
| 496 }); | 533 }); |
| OLD | NEW |