| 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 cr.define('login', function() { | 9 cr.define('login', function() { |
| 10 // Screens that should have offline message overlay. | 10 // Screens that should have offline message overlay. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 var offlineMessage = this; | 154 var offlineMessage = this; |
| 155 var isOnline = (state == NET_STATE.ONLINE); | 155 var isOnline = (state == NET_STATE.ONLINE); |
| 156 var isUnderCaptivePortal = (state == NET_STATE.PORTAL); | 156 var isUnderCaptivePortal = (state == NET_STATE.PORTAL); |
| 157 var isProxyError = reason == ERROR_REASONS.PROXY_AUTH_CANCELLED || | 157 var isProxyError = reason == ERROR_REASONS.PROXY_AUTH_CANCELLED || |
| 158 reason == ERROR_REASONS.PROXY_CONNECTION_FAILED; | 158 reason == ERROR_REASONS.PROXY_CONNECTION_FAILED; |
| 159 var shouldOverlay = MANAGED_SCREENS.indexOf(currentScreen.id) != -1 && | 159 var shouldOverlay = MANAGED_SCREENS.indexOf(currentScreen.id) != -1 && |
| 160 !currentScreen.isLocal; | 160 !currentScreen.isLocal; |
| 161 var isTimeout = false; | 161 var isTimeout = false; |
| 162 var isShown = !offlineMessage.classList.contains('hidden') && | 162 var isShown = !offlineMessage.classList.contains('hidden') && |
| 163 !offlineMessage.classList.contains('faded'); | 163 !offlineMessage.classList.contains('faded'); |
| 164 var currentScreenReloaded = false; |
| 164 | 165 |
| 165 if (reason == ERROR_REASONS.PROXY_CONFIG_CHANGED && shouldOverlay && | 166 if (reason == ERROR_REASONS.PROXY_CONFIG_CHANGED && shouldOverlay && |
| 166 isShown) { | 167 !currentScreenReloaded) { |
| 167 // Schedules a immediate retry. | 168 // Schedules a immediate retry. |
| 168 currentScreen.doReload(); | 169 currentScreen.doReload(); |
| 170 currentScreenReloaded = true; |
| 169 console.log('Retry page load since proxy settings has been changed'); | 171 console.log('Retry page load since proxy settings has been changed'); |
| 170 } | 172 } |
| 171 | 173 |
| 172 // Fake portal state for loading timeout. | 174 // Fake portal state for loading timeout. |
| 173 if (reason == ERROR_REASONS.LOADING_TIMEOUT) { | 175 if (reason == ERROR_REASONS.LOADING_TIMEOUT) { |
| 174 isOnline = false; | 176 isOnline = false; |
| 175 isUnderCaptivePortal = true; | 177 isUnderCaptivePortal = true; |
| 176 isTimeout = true; | 178 isTimeout = true; |
| 177 } | 179 } |
| 178 | 180 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 offlineMessage.classList.add('hidden'); | 273 offlineMessage.classList.add('hidden'); |
| 272 } | 274 } |
| 273 | 275 |
| 274 currentScreen.classList.remove('hidden'); | 276 currentScreen.classList.remove('hidden'); |
| 275 currentScreen.classList.remove('faded'); | 277 currentScreen.classList.remove('faded'); |
| 276 | 278 |
| 277 if (Oobe.getInstance().isNewOobe()) | 279 if (Oobe.getInstance().isNewOobe()) |
| 278 Oobe.getInstance().updateInnerContainerSize_(currentScreen); | 280 Oobe.getInstance().updateInnerContainerSize_(currentScreen); |
| 279 | 281 |
| 280 // Forces a reload for Gaia screen on hiding error message. | 282 // Forces a reload for Gaia screen on hiding error message. |
| 281 if (currentScreen.id == 'gaia-signin') | 283 if (currentScreen.id == 'gaia-signin' && !currentScreenReloaded) { |
| 282 currentScreen.doReload(); | 284 currentScreen.doReload(); |
| 285 currentScreenReloaded = true; |
| 286 } |
| 283 } | 287 } |
| 284 } | 288 } |
| 285 }, | 289 }, |
| 286 | 290 |
| 287 // Request network state update with loading timeout as reason. | 291 // Request network state update with loading timeout as reason. |
| 288 showLoadingTimeoutError: function() { | 292 showLoadingTimeoutError: function() { |
| 289 // Shows error message if it is not shown already. | 293 // Shows error message if it is not shown already. |
| 290 if (this.classList.contains('hidden')) { | 294 if (this.classList.contains('hidden')) { |
| 291 chrome.send('loginRequestNetworkState', | 295 chrome.send('loginRequestNetworkState', |
| 292 ['login.ErrorMessageScreen.updateState', | 296 ['login.ErrorMessageScreen.updateState', |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 * via template. | 357 * via template. |
| 354 */ | 358 */ |
| 355 ErrorMessageScreen.updateLocalizedContent = function() { | 359 ErrorMessageScreen.updateLocalizedContent = function() { |
| 356 $('error-message').updateLocalizedContent_(); | 360 $('error-message').updateLocalizedContent_(); |
| 357 }; | 361 }; |
| 358 | 362 |
| 359 return { | 363 return { |
| 360 ErrorMessageScreen: ErrorMessageScreen | 364 ErrorMessageScreen: ErrorMessageScreen |
| 361 }; | 365 }; |
| 362 }); | 366 }); |
| OLD | NEW |