| 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 27 matching lines...) Expand all Loading... |
| 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 shows Welcome screen. | |
| 49 */ | |
| 50 welcomeScreenShown: { | |
| 51 type: Boolean, | |
| 52 value: true, | |
| 53 }, | |
| 54 | |
| 55 /** | |
| 56 * Flag that shows Language Selection screen. | |
| 57 */ | |
| 58 languageSelectionScreenShown: { | |
| 59 type: Boolean, | |
| 60 value: false, | |
| 61 }, | |
| 62 | |
| 63 /** | |
| 64 * Flag that shows Accessibility Options screen. | |
| 65 */ | |
| 66 accessibilityOptionsScreenShown: { | |
| 67 type: Boolean, | |
| 68 value: false, | |
| 69 }, | |
| 70 | |
| 71 /** | |
| 72 * Flag that shows Timezone Selection screen. | |
| 73 */ | |
| 74 timezoneScreenShown: { | |
| 75 type: Boolean, | |
| 76 value: false, | |
| 77 }, | |
| 78 | |
| 79 /** | |
| 80 * Flag that shows Network Selection screen. | |
| 81 */ | |
| 82 networkSelectionScreenShown: { | |
| 83 type: Boolean, | |
| 84 value: false, | |
| 85 observer: 'networkSelectionScreenShownChanged_', | |
| 86 }, | |
| 87 | |
| 88 /** | |
| 89 * Flag that enables MD-OOBE. | 48 * Flag that enables MD-OOBE. |
| 90 */ | 49 */ |
| 91 enabled: { | 50 enabled: { |
| 92 type: Boolean, | 51 type: Boolean, |
| 93 value: false, | 52 value: false, |
| 94 }, | 53 }, |
| 95 | 54 |
| 96 /** | 55 /** |
| 97 * Accessibility options status. | 56 * Accessibility options status. |
| 98 * @type {!OobeTypes.A11yStatuses} | 57 * @type {!OobeTypes.A11yStatuses} |
| (...skipping 27 matching lines...) Expand all Loading... |
| 126 type: Boolean, | 85 type: Boolean, |
| 127 value: false, | 86 value: false, |
| 128 }, | 87 }, |
| 129 | 88 |
| 130 /** | 89 /** |
| 131 * Controls displaying of "Enable debugging features" link. | 90 * Controls displaying of "Enable debugging features" link. |
| 132 */ | 91 */ |
| 133 debuggingLinkVisible: Boolean, | 92 debuggingLinkVisible: Boolean, |
| 134 }, | 93 }, |
| 135 | 94 |
| 95 /** |
| 96 * GUID of the user-selected network. It is remembered after user taps on |
| 97 * network entry. After we receive event "connected" on this network, |
| 98 * OOBE will proceed. |
| 99 */ |
| 100 networkLastSelectedGuid_: '', |
| 101 |
| 136 /** @override */ | 102 /** @override */ |
| 137 ready: function() { | 103 ready: function() { |
| 138 CrOncStrings = { | 104 CrOncStrings = { |
| 139 OncTypeCellular: loadTimeData.getString('OncTypeCellular'), | 105 OncTypeCellular: loadTimeData.getString('OncTypeCellular'), |
| 140 OncTypeEthernet: loadTimeData.getString('OncTypeEthernet'), | 106 OncTypeEthernet: loadTimeData.getString('OncTypeEthernet'), |
| 141 OncTypeVPN: loadTimeData.getString('OncTypeVPN'), | 107 OncTypeVPN: loadTimeData.getString('OncTypeVPN'), |
| 142 OncTypeWiFi: loadTimeData.getString('OncTypeWiFi'), | 108 OncTypeWiFi: loadTimeData.getString('OncTypeWiFi'), |
| 143 OncTypeWiMAX: loadTimeData.getString('OncTypeWiMAX'), | 109 OncTypeWiMAX: loadTimeData.getString('OncTypeWiMAX'), |
| 144 networkDisabled: loadTimeData.getString('networkDisabled'), | 110 networkDisabled: loadTimeData.getString('networkDisabled'), |
| 145 networkListItemConnected: | 111 networkListItemConnected: |
| 146 loadTimeData.getString('networkListItemConnected'), | 112 loadTimeData.getString('networkListItemConnected'), |
| 147 networkListItemConnecting: | 113 networkListItemConnecting: |
| 148 loadTimeData.getString('networkListItemConnecting'), | 114 loadTimeData.getString('networkListItemConnecting'), |
| 149 networkListItemConnectingTo: | 115 networkListItemConnectingTo: |
| 150 loadTimeData.getString('networkListItemConnectingTo'), | 116 loadTimeData.getString('networkListItemConnectingTo'), |
| 151 networkListItemNotConnected: | 117 networkListItemNotConnected: |
| 152 loadTimeData.getString('networkListItemNotConnected'), | 118 loadTimeData.getString('networkListItemNotConnected'), |
| 153 vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'), | 119 vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'), |
| 154 | 120 |
| 155 // Additional strings for custom items. | 121 // Additional strings for custom items. |
| 156 addMobileNetworkMenuName: | 122 addMobileNetworkMenuName: |
| 157 loadTimeData.getString('addMobileNetworkMenuName'), | 123 loadTimeData.getString('addMobileNetworkMenuName'), |
| 158 addWiFiNetworkMenuName: loadTimeData.getString('addWiFiNetworkMenuName'), | 124 addWiFiNetworkMenuName: loadTimeData.getString('addWiFiNetworkMenuName'), |
| 159 proxySettingsMenuName: loadTimeData.getString('proxySettingsMenuName'), | 125 proxySettingsMenuName: loadTimeData.getString('proxySettingsMenuName'), |
| 160 }; | 126 }; |
| 161 }, | 127 }, |
| 162 | 128 |
| 163 /** | 129 /** |
| 164 * Hides all screens to help switching from one screen to another. | 130 * Hides all screens to help switching from one screen to another. |
| 131 * @private |
| 165 */ | 132 */ |
| 166 hideAllScreens_: function() { | 133 hideAllScreens_: function() { |
| 167 this.welcomeScreenShown = false; | 134 this.$.welcomeScreen.hidden = true; |
| 168 this.networkSelectionScreenShown = false; | |
| 169 this.languageSelectionScreenShown = false; | |
| 170 this.accessibilityOptionsScreenShown = false; | |
| 171 this.timezoneScreenShown = false; | |
| 172 }, | |
| 173 | 135 |
| 174 /** | 136 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog') |
| 175 * GUID of the user-selected network. It is remembered after user taps on | 137 for (var i = 0; i < screens.length; ++i) { |
| 176 * network entry. After we receive event "connected" on this network, | 138 screens[i].hidden = true; |
| 177 * OOBE will proceed. | |
| 178 */ | |
| 179 networkLastSelectedGuid_: '', | |
| 180 | |
| 181 /** | |
| 182 * Sets proper focus. | |
| 183 */ | |
| 184 focus: function() { | |
| 185 this.$.welcomeNextButton.focus(); | |
| 186 }, | |
| 187 | |
| 188 /** @private */ | |
| 189 networkSelectionScreenShownChanged_: function() { | |
| 190 if (this.networkSelectionScreenShown) { | |
| 191 // After #networkSelect is stamped, trigger a refresh so that the list | |
| 192 // will be updated with the currently visible networks and sized | |
| 193 // appropriately. | |
| 194 this.async(function() { | |
| 195 this.$.networkSelect.refreshNetworks(); | |
| 196 }.bind(this)); | |
| 197 } | 139 } |
| 198 }, | 140 }, |
| 199 | 141 |
| 200 /** | 142 /** |
| 143 * Shows given screen. |
| 144 * @param id String Screen ID. |
| 145 * @private |
| 146 */ |
| 147 showScreen_: function(id) { |
| 148 this.hideAllScreens_(); |
| 149 |
| 150 var screen = this.$[id]; |
| 151 assert(screen); |
| 152 screen.hidden = false; |
| 153 screen.show(); |
| 154 }, |
| 155 |
| 156 /** |
| 157 * Returns active screen object. |
| 158 * @private |
| 159 */ |
| 160 getActiveScreen_: function() { |
| 161 var screens = Polymer.dom(this.root).querySelectorAll('oobe-dialog') |
| 162 for (var i = 0; i < screens.length; ++i) { |
| 163 if (!screens[i].hidden) |
| 164 return screens[i]; |
| 165 } |
| 166 return this.$.welcomeScreen; |
| 167 }, |
| 168 |
| 169 focus: function() { |
| 170 this.getActiveScreen_().focus(); |
| 171 }, |
| 172 |
| 173 /** @private */ |
| 174 onNetworkSelectionScreenShown_: function() { |
| 175 // After #networkSelect is stamped, trigger a refresh so that the list |
| 176 // will be updated with the currently visible networks and sized |
| 177 // appropriately. |
| 178 this.async(function() { |
| 179 this.$.networkSelect.refreshNetworks(); |
| 180 }.bind(this)); |
| 181 }, |
| 182 |
| 183 /** |
| 201 * Handles "visible" event. | 184 * Handles "visible" event. |
| 202 * @private | 185 * @private |
| 203 */ | 186 */ |
| 204 onAnimationFinish_: function() { | 187 onAnimationFinish_: function() { |
| 205 this.focus(); | 188 this.focus(); |
| 206 }, | 189 }, |
| 207 | 190 |
| 208 /** | 191 /** |
| 209 * Returns custom items for network selector. | 192 * Returns custom items for network selector. |
| 193 * @private |
| 210 */ | 194 */ |
| 211 _getNetworkCustomItems: function() { | 195 getNetworkCustomItems_: function() { |
| 212 var self = this; | 196 var self = this; |
| 213 return [ | 197 return [ |
| 214 { | 198 { |
| 215 customItemName: 'proxySettingsMenuName', | 199 customItemName: 'proxySettingsMenuName', |
| 216 polymerIcon: 'oobe-welcome-20:add-proxy', | 200 polymerIcon: 'oobe-welcome-20:add-proxy', |
| 217 customData: { | 201 customData: { |
| 218 onTap: function() { self.OpenProxySettingsDialog_(); }, | 202 onTap: function() { self.OpenProxySettingsDialog_(); }, |
| 219 }, | 203 }, |
| 220 }, | 204 }, |
| 221 { | 205 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 242 isTimezoneButtonVisible_: function(highlightStrength) { | 226 isTimezoneButtonVisible_: function(highlightStrength) { |
| 243 return highlightStrength === 'strong'; | 227 return highlightStrength === 'strong'; |
| 244 }, | 228 }, |
| 245 | 229 |
| 246 /** | 230 /** |
| 247 * Handle "Next" button for "Welcome" screen. | 231 * Handle "Next" button for "Welcome" screen. |
| 248 * | 232 * |
| 249 * @private | 233 * @private |
| 250 */ | 234 */ |
| 251 onWelcomeNextButtonClicked_: function() { | 235 onWelcomeNextButtonClicked_: function() { |
| 252 this.hideAllScreens_(); | 236 this.showScreen_('networkSelectionScreen'); |
| 253 this.networkSelectionScreenShown = true; | |
| 254 }, | 237 }, |
| 255 | 238 |
| 256 /** | 239 /** |
| 257 * Handle "Language" button for "Welcome" screen. | 240 * Handle "Language" button for "Welcome" screen. |
| 258 * | 241 * |
| 259 * @private | 242 * @private |
| 260 */ | 243 */ |
| 261 onWelcomeSelectLanguageButtonClicked_: function() { | 244 onWelcomeSelectLanguageButtonClicked_: function() { |
| 262 this.hideAllScreens_(); | 245 this.showScreen_('languageScreen'); |
| 263 this.languageSelectionScreenShown = true; | |
| 264 }, | 246 }, |
| 265 | 247 |
| 266 /** | 248 /** |
| 267 * Handle "Accessibility" button for "Welcome" screen. | 249 * Handle "Accessibility" button for "Welcome" screen. |
| 268 * | 250 * |
| 269 * @private | 251 * @private |
| 270 */ | 252 */ |
| 271 onWelcomeAccessibilityButtonClicked_: function() { | 253 onWelcomeAccessibilityButtonClicked_: function() { |
| 272 this.hideAllScreens_(); | 254 this.showScreen_('accessibilityScreen'); |
| 273 this.accessibilityOptionsScreenShown = true; | |
| 274 }, | 255 }, |
| 275 | 256 |
| 276 /** | 257 /** |
| 277 * Handle "Timezone" button for "Welcome" screen. | 258 * Handle "Timezone" button for "Welcome" screen. |
| 278 * | 259 * |
| 279 * @private | 260 * @private |
| 280 */ | 261 */ |
| 281 onWelcomeTimezoneButtonClicked_: function() { | 262 onWelcomeTimezoneButtonClicked_: function() { |
| 282 this.hideAllScreens_(); | 263 this.showScreen_('timezoneScreen'); |
| 283 this.timezoneScreenShown = true; | |
| 284 }, | 264 }, |
| 285 | 265 |
| 286 /** | 266 /** |
| 287 * Handle Networwork Setup screen "Proxy settings" button. | 267 * Handle Networwork Setup screen "Proxy settings" button. |
| 288 * | 268 * |
| 289 * @private | 269 * @private |
| 290 */ | 270 */ |
| 291 OpenProxySettingsDialog_: function(item) { | 271 OpenProxySettingsDialog_: function(item) { |
| 292 chrome.send('launchProxySettingsDialog'); | 272 chrome.send('launchProxySettingsDialog'); |
| 293 }, | 273 }, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 itemState.customData.onTap(); | 365 itemState.customData.onTap(); |
| 386 }, | 366 }, |
| 387 | 367 |
| 388 /** | 368 /** |
| 389 * Handle "<- Back" button on network selection screen. | 369 * Handle "<- Back" button on network selection screen. |
| 390 * | 370 * |
| 391 * @private | 371 * @private |
| 392 */ | 372 */ |
| 393 onNetworkSelectionBackButtonPressed_: function() { | 373 onNetworkSelectionBackButtonPressed_: function() { |
| 394 this.networkLastSelectedGuid_ = ''; | 374 this.networkLastSelectedGuid_ = ''; |
| 395 this.hideAllScreens_(); | 375 this.showScreen_('welcomeScreen'); |
| 396 this.welcomeScreenShown = true; | |
| 397 }, | 376 }, |
| 398 | 377 |
| 399 /** | 378 /** |
| 400 * Handle language selection. | 379 * Handle language selection. |
| 401 * | 380 * |
| 402 * @param {!{detail: {!OobeTypes.LanguageDsc}}} event | 381 * @param {!{detail: {!OobeTypes.LanguageDsc}}} event |
| 403 * @private | 382 * @private |
| 404 */ | 383 */ |
| 405 onLanguageSelected_: function(event) { | 384 onLanguageSelected_: function(event) { |
| 406 var item = event.detail; | 385 var item = event.detail; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 429 onKeyboardsChanged_: function() { | 408 onKeyboardsChanged_: function() { |
| 430 this.currentKeyboard = Oobe.getSelectedTitle(this.keyboards); | 409 this.currentKeyboard = Oobe.getSelectedTitle(this.keyboards); |
| 431 }, | 410 }, |
| 432 | 411 |
| 433 /** | 412 /** |
| 434 * Handle "OK" button for "LanguageSelection" screen. | 413 * Handle "OK" button for "LanguageSelection" screen. |
| 435 * | 414 * |
| 436 * @private | 415 * @private |
| 437 */ | 416 */ |
| 438 closeLanguageSection_: function() { | 417 closeLanguageSection_: function() { |
| 439 this.hideAllScreens_(); | 418 this.showScreen_('welcomeScreen'); |
| 440 this.welcomeScreenShown = true; | |
| 441 }, | 419 }, |
| 442 | 420 |
| 443 /** ******************** Accessibility section ******************* */ | 421 /** ******************** Accessibility section ******************* */ |
| 444 | 422 |
| 445 /** | 423 /** |
| 446 * Handle "OK" button for "Accessibility Options" screen. | 424 * Handle "OK" button for "Accessibility Options" screen. |
| 447 * | 425 * |
| 448 * @private | 426 * @private |
| 449 */ | 427 */ |
| 450 closeAccessibilitySection_: function() { | 428 closeAccessibilitySection_: function() { |
| 451 this.hideAllScreens_(); | 429 this.showScreen_('welcomeScreen'); |
| 452 this.welcomeScreenShown = true; | |
| 453 }, | 430 }, |
| 454 | 431 |
| 455 /** | 432 /** |
| 456 * Handle all accessibility buttons. | 433 * Handle all accessibility buttons. |
| 457 * Note that each <oobe-a11y-option> has chromeMessage attribute | 434 * Note that each <oobe-a11y-option> has chromeMessage attribute |
| 458 * containing Chromium callback name. | 435 * containing Chromium callback name. |
| 459 * | 436 * |
| 460 * @private | 437 * @private |
| 461 * @param {!Event} event | 438 * @param {!Event} event |
| 462 */ | 439 */ |
| 463 onA11yOptionChanged_: function(event) { | 440 onA11yOptionChanged_: function(event) { |
| 464 chrome.send( | 441 chrome.send( |
| 465 event.currentTarget.chromeMessage, [event.currentTarget.checked]); | 442 event.currentTarget.chromeMessage, [event.currentTarget.checked]); |
| 466 }, | 443 }, |
| 467 | 444 |
| 468 /** ******************** Timezone section ******************* */ | 445 /** ******************** Timezone section ******************* */ |
| 469 | 446 |
| 470 /** | 447 /** |
| 471 * Handle "OK" button for "Timezone Selection" screen. | 448 * Handle "OK" button for "Timezone Selection" screen. |
| 472 * | 449 * |
| 473 * @private | 450 * @private |
| 474 */ | 451 */ |
| 475 closeTimezoneSection_: function() { | 452 closeTimezoneSection_: function() { |
| 476 this.hideAllScreens_(); | 453 this.showScreen_('welcomeScreen'); |
| 477 this.welcomeScreenShown = true; | |
| 478 }, | 454 }, |
| 479 | 455 |
| 480 /** | 456 /** |
| 481 * Handle timezone selection. | 457 * Handle timezone selection. |
| 482 * | 458 * |
| 483 * @param {!{detail: {!OobeTypes.Timezone}}} event | 459 * @param {!{detail: {!OobeTypes.Timezone}}} event |
| 484 * @private | 460 * @private |
| 485 */ | 461 */ |
| 486 onTimezoneSelected_: function(event) { | 462 onTimezoneSelected_: function(event) { |
| 487 var item = event.detail; | 463 var item = event.detail; |
| 488 if (!item) | 464 if (!item) |
| 489 return; | 465 return; |
| 490 | 466 |
| 491 this.screen.onTimezoneSelected_(item.value); | 467 this.screen.onTimezoneSelected_(item.value); |
| 492 }, | 468 }, |
| 493 | 469 |
| 494 /** | 470 /** |
| 495 * This function formats message for labels. | 471 * This function formats message for labels. |
| 496 * @param String label i18n string ID. | 472 * @param String label i18n string ID. |
| 497 * @param String parameter i18n string parameter. | 473 * @param String parameter i18n string parameter. |
| 498 * @private | 474 * @private |
| 499 */ | 475 */ |
| 500 formatMessage_: function(label, parameter) { | 476 formatMessage_: function(label, parameter) { |
| 501 return loadTimeData.getStringF(label, parameter); | 477 return loadTimeData.getStringF(label, parameter); |
| 502 }, | 478 }, |
| 503 }); | 479 }); |
| OLD | NEW |