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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Flag that shows Accessibility Options screen. | 54 * Flag that shows Accessibility Options screen. |
| 55 */ | 55 */ |
| 56 accessibilityOptionsScreenShown: { | 56 accessibilityOptionsScreenShown: { |
| 57 type: Boolean, | 57 type: Boolean, |
| 58 value: false, | 58 value: false, |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Flag that shows Timezone Selection screen. | |
| 63 */ | |
| 64 timezoneScreenShown: { | |
| 65 type: Boolean, | |
| 66 value: false, | |
| 67 }, | |
| 68 | |
| 69 /** | |
| 62 * Flag that shows Network Selection screen. | 70 * Flag that shows Network Selection screen. |
| 63 */ | 71 */ |
| 64 networkSelectionScreenShown: { | 72 networkSelectionScreenShown: { |
| 65 type: Boolean, | 73 type: Boolean, |
| 66 value: false, | 74 value: false, |
| 67 }, | 75 }, |
| 68 | 76 |
| 69 /** | 77 /** |
| 70 * Flag that enables MD-OOBE. | 78 * Flag that enables MD-OOBE. |
| 71 */ | 79 */ |
| 72 enabled: { | 80 enabled: { |
| 73 type: Boolean, | 81 type: Boolean, |
| 74 value: false, | 82 value: false, |
| 75 }, | 83 }, |
| 76 | 84 |
| 77 /** | 85 /** |
| 78 * Accessibility options status. | 86 * Accessibility options status. |
| 79 * @type {!OobeTypes.A11yStatuses} | 87 * @type {!OobeTypes.A11yStatuses} |
| 80 */ | 88 */ |
| 81 a11yStatus: { | 89 a11yStatus: { |
| 82 type: Object, | 90 type: Object, |
| 83 }, | 91 }, |
| 92 | |
| 93 /** | |
| 94 * A list of timezones for Timezone Selection screen. | |
| 95 * @type {!Array<OobeTypes.TimezoneDsc>} | |
| 96 */ | |
| 97 timezones: { | |
| 98 type: Object, | |
| 99 value: [], | |
| 100 }, | |
| 101 | |
| 102 /** | |
| 103 * If UI uses forced keyboard navigation. | |
| 104 */ | |
| 105 highlightStrength: { | |
| 106 type: String, | |
| 107 value: '', | |
| 108 }, | |
| 84 }, | 109 }, |
| 85 | 110 |
| 86 /** | 111 /** |
| 87 * Hides all screens to help switching from one screen to another. | 112 * Hides all screens to help switching from one screen to another. |
| 88 */ | 113 */ |
| 89 hideAllScreens_: function() { | 114 hideAllScreens_: function() { |
| 90 this.welcomeScreenShown = false; | 115 this.welcomeScreenShown = false; |
| 91 this.networkSelectionScreenShown = false; | 116 this.networkSelectionScreenShown = false; |
| 92 this.languageSelectionScreenShown = false; | 117 this.languageSelectionScreenShown = false; |
| 93 this.accessibilityOptionsScreenShown = false; | 118 this.accessibilityOptionsScreenShown = false; |
| 119 this.timezoneScreenShown = false; | |
| 94 }, | 120 }, |
| 95 | 121 |
| 96 /** | 122 /** |
| 97 * GUID of the user-selected network. It is remembered after user taps on | 123 * GUID of the user-selected network. It is remembered after user taps on |
| 98 * network entry. After we receive event "connected" on this network, | 124 * network entry. After we receive event "connected" on this network, |
| 99 * OOBE will proceed. | 125 * OOBE will proceed. |
| 100 */ | 126 */ |
| 101 networkLastSelectedGuid_: '', | 127 networkLastSelectedGuid_: '', |
| 102 | 128 |
| 103 /** | 129 /** |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 customItemName: 'addMobileNetworkMenuName', | 165 customItemName: 'addMobileNetworkMenuName', |
| 140 polymerIcon: 'oobe-welcome-20:add-cellular', | 166 polymerIcon: 'oobe-welcome-20:add-cellular', |
| 141 customData: { | 167 customData: { |
| 142 onTap: function() { self.OpenAddWiFiNetworkDialog_(); }, | 168 onTap: function() { self.OpenAddWiFiNetworkDialog_(); }, |
| 143 }, | 169 }, |
| 144 }, | 170 }, |
| 145 ]; | 171 ]; |
| 146 }, | 172 }, |
| 147 | 173 |
| 148 /** | 174 /** |
| 175 * Returns true if timezone button should be visible. | |
| 176 * @private | |
| 177 */ | |
| 178 isTimezoneButtonVisible_: function(highlightStrength) { | |
| 179 if (!highlightStrength) | |
| 180 return false; | |
| 181 | |
| 182 if (highlightStrength == 'strong') | |
| 183 return true; | |
| 184 | |
| 185 return false; | |
|
xiyuan
2016/12/09 17:50:59
nit: think we can do
return highlightStrength =
Alexander Alekseev
2016/12/10 00:43:00
Done.
| |
| 186 }, | |
| 187 | |
| 188 /** | |
| 149 * Handle "Next" button for "Welcome" screen. | 189 * Handle "Next" button for "Welcome" screen. |
| 150 * | 190 * |
| 151 * @private | 191 * @private |
| 152 */ | 192 */ |
| 153 onWelcomeNextButtonClicked_: function() { | 193 onWelcomeNextButtonClicked_: function() { |
| 154 this.hideAllScreens_(); | 194 this.hideAllScreens_(); |
| 155 this.networkSelectionScreenShown = true; | 195 this.networkSelectionScreenShown = true; |
| 156 }, | 196 }, |
| 157 | 197 |
| 158 /** | 198 /** |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 169 * Handle "Accessibility" button for "Welcome" screen. | 209 * Handle "Accessibility" button for "Welcome" screen. |
| 170 * | 210 * |
| 171 * @private | 211 * @private |
| 172 */ | 212 */ |
| 173 onWelcomeAccessibilityButtonClicked_: function() { | 213 onWelcomeAccessibilityButtonClicked_: function() { |
| 174 this.hideAllScreens_(); | 214 this.hideAllScreens_(); |
| 175 this.accessibilityOptionsScreenShown = true; | 215 this.accessibilityOptionsScreenShown = true; |
| 176 }, | 216 }, |
| 177 | 217 |
| 178 /** | 218 /** |
| 219 * Handle "Timezone" button for "Welcome" screen. | |
| 220 * | |
| 221 * @private | |
| 222 */ | |
| 223 onWelcomeTimezoneButtonClicked_: function() { | |
| 224 this.hideAllScreens_(); | |
| 225 this.timezoneScreenShown = true; | |
| 226 }, | |
| 227 | |
| 228 /** | |
| 179 * Handle Networwork Setup screen "Proxy settings" button. | 229 * Handle Networwork Setup screen "Proxy settings" button. |
| 180 * | 230 * |
| 181 * @private | 231 * @private |
| 182 */ | 232 */ |
| 183 OpenProxySettingsDialog_: function(item) { | 233 OpenProxySettingsDialog_: function(item) { |
| 184 chrome.send('launchProxySettingsDialog'); | 234 chrome.send('launchProxySettingsDialog'); |
| 185 }, | 235 }, |
| 186 | 236 |
| 187 /** | 237 /** |
| 188 * Handle Networwork Setup screen "Add WiFi network" button. | 238 * Handle Networwork Setup screen "Add WiFi network" button. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 * Note that each <oobe-a11y-option> has chromeMessage attribute | 388 * Note that each <oobe-a11y-option> has chromeMessage attribute |
| 339 * containing Chromium callback name. | 389 * containing Chromium callback name. |
| 340 * | 390 * |
| 341 * @private | 391 * @private |
| 342 * @param {!Event} event | 392 * @param {!Event} event |
| 343 */ | 393 */ |
| 344 onA11yOptionChanged_: function(event) { | 394 onA11yOptionChanged_: function(event) { |
| 345 chrome.send( | 395 chrome.send( |
| 346 event.currentTarget.chromeMessage, [event.currentTarget.checked]); | 396 event.currentTarget.chromeMessage, [event.currentTarget.checked]); |
| 347 }, | 397 }, |
| 398 | |
| 399 /** ******************** Timezone section ******************* */ | |
| 400 | |
| 401 /** | |
| 402 * Handle "OK" button for "Timezone Selection" screen. | |
| 403 * | |
| 404 * @private | |
| 405 */ | |
| 406 closeTimezoneSection_: function() { | |
| 407 this.hideAllScreens_(); | |
| 408 this.welcomeScreenShown = true; | |
| 409 }, | |
| 410 | |
| 411 /** | |
| 412 * Handle timezone selection. | |
| 413 * | |
| 414 * @param {!{detail: {!OobeTypes.Timezone}}} event | |
| 415 * @private | |
| 416 */ | |
| 417 onTimezoneSelected_: function(event) { | |
| 418 var item = event.detail; | |
| 419 if (!item) | |
| 420 return; | |
| 421 | |
| 422 var timezone = item.value; | |
|
xiyuan
2016/12/09 17:50:59
nit: get rid of |timezone| and use item.value in p
Alexander Alekseev
2016/12/10 00:43:00
Done.
| |
| 423 this.screen.onTimezoneSelected_(timezone); | |
| 424 }, | |
| 348 }); | 425 }); |
| OLD | NEW |