OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 Offline message screen implementation. | 6 * @fileoverview Offline message screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('ErrorMessageScreen', 'error-message', function() { | 9 login.createScreen('ErrorMessageScreen', 'error-message', function() { |
| 10 var USER_ACTION_CONFIGURE_CERTS = 'configure-certs'; |
| 11 var USER_ACTION_DIAGNOSE = 'diagnose'; |
| 12 var USER_ACTION_LAUNCH_OOBE_GUEST = 'launch-oobe-guest'; |
| 13 var USER_ACTION_LOCAL_STATE_POWERWASH = 'local-state-error-powerwash'; |
| 14 var USER_ACTION_REBOOT = 'reboot'; |
| 15 var USER_ACTION_SHOW_CAPTIVE_PORTAL = 'show-captive-portal'; |
| 16 |
10 // Link which starts guest session for captive portal fixing. | 17 // Link which starts guest session for captive portal fixing. |
11 /** @const */ var FIX_CAPTIVE_PORTAL_ID = 'captive-portal-fix-link'; | 18 /** @const */ var FIX_CAPTIVE_PORTAL_ID = 'captive-portal-fix-link'; |
12 | 19 |
13 /** @const */ var FIX_PROXY_SETTINGS_ID = 'proxy-settings-fix-link'; | 20 /** @const */ var FIX_PROXY_SETTINGS_ID = 'proxy-settings-fix-link'; |
14 | 21 |
15 // Class of the elements which hold current network name. | 22 // Class of the elements which hold current network name. |
16 /** @const */ var CURRENT_NETWORK_NAME_CLASS = | 23 /** @const */ var CURRENT_NETWORK_NAME_CLASS = |
17 'portal-network-name'; | 24 'portal-network-name'; |
18 | 25 |
19 // Link which triggers frame reload. | 26 // Link which triggers frame reload. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 /** @override */ | 85 /** @override */ |
79 decorate: function() { | 86 decorate: function() { |
80 cr.ui.DropDown.decorate($('offline-networks-list')); | 87 cr.ui.DropDown.decorate($('offline-networks-list')); |
81 this.updateLocalizedContent(); | 88 this.updateLocalizedContent(); |
82 }, | 89 }, |
83 | 90 |
84 /** | 91 /** |
85 * Updates localized content of the screen that is not updated via template. | 92 * Updates localized content of the screen that is not updated via template. |
86 */ | 93 */ |
87 updateLocalizedContent: function() { | 94 updateLocalizedContent: function() { |
| 95 var self = this; |
88 $('auto-enrollment-offline-message-text').innerHTML = | 96 $('auto-enrollment-offline-message-text').innerHTML = |
89 loadTimeData.getStringF( | 97 loadTimeData.getStringF( |
90 'autoEnrollmentOfflineMessageBody', | 98 'autoEnrollmentOfflineMessageBody', |
91 '<b class="' + CURRENT_NETWORK_NAME_CLASS + '"></b>', | 99 '<b class="' + CURRENT_NETWORK_NAME_CLASS + '"></b>', |
92 '<a id="auto-enrollment-learn-more" class="signin-link" ' + | 100 '<a id="auto-enrollment-learn-more" class="signin-link" ' + |
93 '"href="#">', | 101 '"href="#">', |
94 '</a>'); | 102 '</a>'); |
95 $('auto-enrollment-learn-more').onclick = function() { | 103 $('auto-enrollment-learn-more').onclick = function() { |
96 chrome.send('launchHelpApp', [HELP_TOPIC_AUTO_ENROLLMENT]); | 104 chrome.send('launchHelpApp', [HELP_TOPIC_AUTO_ENROLLMENT]); |
97 }; | 105 }; |
98 | 106 |
99 $('captive-portal-message-text').innerHTML = loadTimeData.getStringF( | 107 $('captive-portal-message-text').innerHTML = loadTimeData.getStringF( |
100 'captivePortalMessage', | 108 'captivePortalMessage', |
101 '<b class="' + CURRENT_NETWORK_NAME_CLASS + '"></b>', | 109 '<b class="' + CURRENT_NETWORK_NAME_CLASS + '"></b>', |
102 '<a id="' + FIX_CAPTIVE_PORTAL_ID + '" class="signin-link" href="#">', | 110 '<a id="' + FIX_CAPTIVE_PORTAL_ID + '" class="signin-link" href="#">', |
103 '</a>'); | 111 '</a>'); |
104 $(FIX_CAPTIVE_PORTAL_ID).onclick = function() { | 112 $(FIX_CAPTIVE_PORTAL_ID).onclick = function() { |
105 chrome.send('showCaptivePortal'); | 113 self.send(login.Screen.CALLBACK_USER_ACTED, |
| 114 USER_ACTION_SHOW_CAPTIVE_PORTAL); |
106 }; | 115 }; |
107 | 116 |
108 $('captive-portal-proxy-message-text').innerHTML = | 117 $('captive-portal-proxy-message-text').innerHTML = |
109 loadTimeData.getStringF( | 118 loadTimeData.getStringF( |
110 'captivePortalProxyMessage', | 119 'captivePortalProxyMessage', |
111 '<a id="' + FIX_PROXY_SETTINGS_ID + '" class="signin-link" href="#">', | 120 '<a id="' + FIX_PROXY_SETTINGS_ID + '" class="signin-link" href="#">', |
112 '</a>'); | 121 '</a>'); |
113 $(FIX_PROXY_SETTINGS_ID).onclick = function() { | 122 $(FIX_PROXY_SETTINGS_ID).onclick = function() { |
114 chrome.send('openProxySettings'); | 123 chrome.send('openProxySettings'); |
115 }; | 124 }; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 onBeforeHide: function() { | 204 onBeforeHide: function() { |
196 cr.ui.DropDown.hide('offline-networks-list'); | 205 cr.ui.DropDown.hide('offline-networks-list'); |
197 }, | 206 }, |
198 | 207 |
199 /** | 208 /** |
200 * Buttons in oobe wizard's button strip. | 209 * Buttons in oobe wizard's button strip. |
201 * @type {array} Array of Buttons. | 210 * @type {array} Array of Buttons. |
202 */ | 211 */ |
203 get buttons() { | 212 get buttons() { |
204 var buttons = []; | 213 var buttons = []; |
| 214 var self = this; |
205 | 215 |
206 var rebootButton = this.ownerDocument.createElement('button'); | 216 var rebootButton = this.ownerDocument.createElement('button'); |
207 rebootButton.textContent = loadTimeData.getString('rebootButton'); | 217 rebootButton.textContent = loadTimeData.getString('rebootButton'); |
208 rebootButton.classList.add('show-with-ui-state-kiosk-mode'); | 218 rebootButton.classList.add('show-with-ui-state-kiosk-mode'); |
209 rebootButton.addEventListener('click', function(e) { | 219 rebootButton.addEventListener('click', function(e) { |
210 chrome.send('rebootButtonClicked'); | 220 self.send(login.Screen.CALLBACK_USER_ACTED, USER_ACTION_REBOOT); |
211 e.stopPropagation(); | 221 e.stopPropagation(); |
212 }); | 222 }); |
213 buttons.push(rebootButton); | 223 buttons.push(rebootButton); |
214 | 224 |
215 var diagnoseButton = this.ownerDocument.createElement('button'); | 225 var diagnoseButton = this.ownerDocument.createElement('button'); |
216 diagnoseButton.textContent = loadTimeData.getString('diagnoseButton'); | 226 diagnoseButton.textContent = loadTimeData.getString('diagnoseButton'); |
217 diagnoseButton.classList.add('show-with-ui-state-kiosk-mode'); | 227 diagnoseButton.classList.add('show-with-ui-state-kiosk-mode'); |
218 diagnoseButton.addEventListener('click', function(e) { | 228 diagnoseButton.addEventListener('click', function(e) { |
219 chrome.send('diagnoseButtonClicked'); | 229 self.send(login.Screen.CALLBACK_USER_ACTED, USER_ACTION_DIAGNOSE); |
220 e.stopPropagation(); | 230 e.stopPropagation(); |
221 }); | 231 }); |
222 buttons.push(diagnoseButton); | 232 buttons.push(diagnoseButton); |
223 | 233 |
224 var certsButton = this.ownerDocument.createElement('button'); | 234 var certsButton = this.ownerDocument.createElement('button'); |
225 certsButton.textContent = loadTimeData.getString('configureCertsButton'); | 235 certsButton.textContent = loadTimeData.getString('configureCertsButton'); |
226 certsButton.classList.add('show-with-ui-state-kiosk-mode'); | 236 certsButton.classList.add('show-with-ui-state-kiosk-mode'); |
227 certsButton.addEventListener('click', function(e) { | 237 certsButton.addEventListener('click', function(e) { |
228 chrome.send('configureCertsClicked'); | 238 self.send(login.Screen.CALLBACK_USER_ACTED, |
| 239 USER_ACTION_CONFIGURE_CERTS); |
229 e.stopPropagation(); | 240 e.stopPropagation(); |
230 }); | 241 }); |
231 buttons.push(certsButton); | 242 buttons.push(certsButton); |
232 | 243 |
233 var continueButton = this.ownerDocument.createElement('button'); | 244 var continueButton = this.ownerDocument.createElement('button'); |
234 continueButton.id = 'continue-network-config-btn'; | 245 continueButton.id = 'continue-network-config-btn'; |
235 continueButton.textContent = loadTimeData.getString('continueButton'); | 246 continueButton.textContent = loadTimeData.getString('continueButton'); |
236 continueButton.classList.add('show-with-error-state-kiosk-online'); | 247 continueButton.classList.add('show-with-error-state-kiosk-online'); |
237 continueButton.addEventListener('click', function(e) { | 248 continueButton.addEventListener('click', function(e) { |
238 chrome.send('continueAppLaunch'); | 249 chrome.send('continueAppLaunch'); |
(...skipping 15 matching lines...) Expand all Loading... |
254 spacer.classList.add('button-spacer'); | 265 spacer.classList.add('button-spacer'); |
255 spacer.classList.add('show-with-ui-state-kiosk-mode'); | 266 spacer.classList.add('show-with-ui-state-kiosk-mode'); |
256 buttons.push(spacer); | 267 buttons.push(spacer); |
257 | 268 |
258 var powerwashButton = this.ownerDocument.createElement('button'); | 269 var powerwashButton = this.ownerDocument.createElement('button'); |
259 powerwashButton.id = 'error-message-restart-and-powerwash-button'; | 270 powerwashButton.id = 'error-message-restart-and-powerwash-button'; |
260 powerwashButton.textContent = | 271 powerwashButton.textContent = |
261 loadTimeData.getString('localStateErrorPowerwashButton'); | 272 loadTimeData.getString('localStateErrorPowerwashButton'); |
262 powerwashButton.classList.add('show-with-ui-state-local-state-error'); | 273 powerwashButton.classList.add('show-with-ui-state-local-state-error'); |
263 powerwashButton.addEventListener('click', function(e) { | 274 powerwashButton.addEventListener('click', function(e) { |
264 chrome.send('localStateErrorPowerwashButtonClicked'); | 275 self.send(login.Screen.CALLBACK_USER_ACTED, |
| 276 USER_ACTION_LOCAL_STATE_POWERWASH); |
265 e.stopPropagation(); | 277 e.stopPropagation(); |
266 }); | 278 }); |
267 buttons.push(powerwashButton); | 279 buttons.push(powerwashButton); |
268 | 280 |
269 return buttons; | 281 return buttons; |
270 }, | 282 }, |
271 | 283 |
272 /** | 284 /** |
273 * Sets current UI state of the screen. | 285 * Sets current UI state of the screen. |
274 * @param {string} ui_state New UI state of the screen. | 286 * @param {string} ui_state New UI state of the screen. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 onContentChange_: function() { | 323 onContentChange_: function() { |
312 if (Oobe.getInstance().currentScreen === this) | 324 if (Oobe.getInstance().currentScreen === this) |
313 Oobe.getInstance().updateScreenSize(this); | 325 Oobe.getInstance().updateScreenSize(this); |
314 }, | 326 }, |
315 | 327 |
316 /** | 328 /** |
317 * Event handler for guest session launch. | 329 * Event handler for guest session launch. |
318 * @private | 330 * @private |
319 */ | 331 */ |
320 launchGuestSession_: function() { | 332 launchGuestSession_: function() { |
321 chrome.send(Oobe.getInstance().isOobeUI() ? | 333 if (Oobe.getInstance().isOobeUI()) { |
322 'launchOobeGuestSession' : 'launchIncognito'); | 334 this.send(login.Screen.CALLBACK_USER_ACTED, |
| 335 USER_ACTION_LAUNCH_OOBE_GUEST); |
| 336 } else { |
| 337 chrome.send('launchIncognito'); |
| 338 } |
323 }, | 339 }, |
324 | 340 |
325 /** | 341 /** |
326 * Prepares error screen to show guest signin link. | 342 * Prepares error screen to show guest signin link. |
327 * @private | 343 * @private |
328 */ | 344 */ |
329 allowGuestSignin: function(allowed) { | 345 allowGuestSignin: function(allowed) { |
330 this.classList.toggle('allow-guest-signin', allowed); | 346 this.classList.toggle('allow-guest-signin', allowed); |
331 this.onContentChange_(); | 347 this.onContentChange_(); |
332 }, | 348 }, |
(...skipping 29 matching lines...) Expand all Loading... |
362 /** | 378 /** |
363 * Updates visibility of the label indicating we're reconnecting. | 379 * Updates visibility of the label indicating we're reconnecting. |
364 * @param {boolean} show Whether the label should be shown. | 380 * @param {boolean} show Whether the label should be shown. |
365 */ | 381 */ |
366 showConnectingIndicator: function(show) { | 382 showConnectingIndicator: function(show) { |
367 this.classList.toggle('show-connecting-indicator', show); | 383 this.classList.toggle('show-connecting-indicator', show); |
368 this.onContentChange_(); | 384 this.onContentChange_(); |
369 } | 385 } |
370 }; | 386 }; |
371 }); | 387 }); |
OLD | NEW |