Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_error_message.js

Issue 10827398: [cros] Fix error message screen hiding when not animated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }, 137 },
138 138
139 update: function() { 139 update: function() {
140 chrome.send('loginRequestNetworkState', 140 chrome.send('loginRequestNetworkState',
141 ['login.ErrorMessageScreen.updateState', 141 ['login.ErrorMessageScreen.updateState',
142 'update']); 142 'update']);
143 }, 143 },
144 144
145 /** 145 /**
146 * Shows or hides offline message based on network on/offline state. 146 * Shows or hides offline message based on network on/offline state.
147 * @param {Integer} state Current state of the network (see NET_STATE). 147 * @param {number} state Current state of the network (see NET_STATE).
148 * @param {string} network Name of the current network. 148 * @param {string} network Name of the current network.
149 * @param {string} reason Reason the callback was called. 149 * @param {string} reason Reason the callback was called.
150 * @param {int} lastNetworkType Last active network type. 150 * @param {number} lastNetworkType Last active network type.
151 */ 151 */
152 updateState_: function(state, network, reason, lastNetworkType) { 152 updateState_: function(state, network, reason, lastNetworkType) {
153 var currentScreen = Oobe.getInstance().currentScreen; 153 var currentScreen = Oobe.getInstance().currentScreen;
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;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } else { 253 } else {
254 chrome.send('hideCaptivePortal'); 254 chrome.send('hideCaptivePortal');
255 255
256 if (!offlineMessage.classList.contains('faded')) { 256 if (!offlineMessage.classList.contains('faded')) {
257 console.log('Hide offline message. state=' + state + 257 console.log('Hide offline message. state=' + state +
258 ', network=' + network + ', reason=' + reason); 258 ', network=' + network + ', reason=' + reason);
259 259
260 offlineMessage.onBeforeHide(); 260 offlineMessage.onBeforeHide();
261 261
262 offlineMessage.classList.add('faded'); 262 offlineMessage.classList.add('faded');
263 offlineMessage.addEventListener('webkitTransitionEnd', 263 if (offlineMessage.classList.contains('animated')) {
264 function f(e) { 264 offlineMessage.addEventListener('webkitTransitionEnd',
265 offlineMessage.removeEventListener('webkitTransitionEnd', f); 265 function f(e) {
266 if (offlineMessage.classList.contains('faded')) 266 offlineMessage.removeEventListener('webkitTransitionEnd', f);
267 offlineMessage.classList.add('hidden'); 267 if (offlineMessage.classList.contains('faded'))
268 }); 268 offlineMessage.classList.add('hidden');
269 });
270 } else {
271 offlineMessage.classList.add('hidden');
272 }
269 273
270 currentScreen.classList.remove('hidden'); 274 currentScreen.classList.remove('hidden');
271 currentScreen.classList.remove('faded'); 275 currentScreen.classList.remove('faded');
272 276
273 if (Oobe.getInstance().isNewOobe()) 277 if (Oobe.getInstance().isNewOobe())
274 Oobe.getInstance().updateInnerContainerSize_(currentScreen); 278 Oobe.getInstance().updateInnerContainerSize_(currentScreen);
275 279
276 // Forces a reload for Gaia screen on hiding error message. 280 // Forces a reload for Gaia screen on hiding error message.
277 if (currentScreen.id == 'gaia-signin') 281 if (currentScreen.id == 'gaia-signin')
278 currentScreen.doReload(); 282 currentScreen.doReload();
279 } 283 }
280 } 284 }
281 }, 285 },
282 286
283 // Request network state update with loading timeout as reason. 287 // Request network state update with loading timeout as reason.
284 showLoadingTimeoutError: function() { 288 showLoadingTimeoutError: function() {
285 // Shows error message if it is not shown already. 289 // Shows error message if it is not shown already.
286 if (this.classList.contains('hidden')) { 290 if (this.classList.contains('hidden')) {
287 chrome.send('loginRequestNetworkState', 291 chrome.send('loginRequestNetworkState',
288 ['login.ErrorMessageScreen.updateState', 292 ['login.ErrorMessageScreen.updateState',
289 ERROR_REASONS.LOADING_TIMEOUT]); 293 ERROR_REASONS.LOADING_TIMEOUT]);
290 } 294 }
291 } 295 }
292 }; 296 };
293 297
294 /** 298 /**
295 * Network state changed callback. 299 * Network state changed callback.
296 * @param {Integer} state Current state of the network (see NET_STATE). 300 * @param {number} state Current state of the network (see NET_STATE).
297 * @param {string} network Name of the current network. 301 * @param {string} network Name of the current network.
298 * @param {string} reason Reason the callback was called. 302 * @param {string} reason Reason the callback was called.
299 * @param {int} lastNetworkType Last active network type. 303 * @param {number} lastNetworkType Last active network type.
300 */ 304 */
301 ErrorMessageScreen.updateState = function( 305 ErrorMessageScreen.updateState = function(
302 state, network, reason, lastNetworkType) { 306 state, network, reason, lastNetworkType) {
303 $('error-message').updateState_(state, network, reason, lastNetworkType); 307 $('error-message').updateState_(state, network, reason, lastNetworkType);
304 }; 308 };
305 309
306 /** 310 /**
307 * Handler for iframe's error notification coming from the outside. 311 * Handler for iframe's error notification coming from the outside.
308 * For more info see C++ class 'SnifferObserver' which calls this method. 312 * For more info see C++ class 'SnifferObserver' which calls this method.
309 * @param {number} error Error code. 313 * @param {number} error Error code.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 * via template. 353 * via template.
350 */ 354 */
351 ErrorMessageScreen.updateLocalizedContent = function() { 355 ErrorMessageScreen.updateLocalizedContent = function() {
352 $('error-message').updateLocalizedContent_(); 356 $('error-message').updateLocalizedContent_();
353 }; 357 };
354 358
355 return { 359 return {
356 ErrorMessageScreen: ErrorMessageScreen 360 ErrorMessageScreen: ErrorMessageScreen
357 }; 361 };
358 }); 362 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698