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 Login UI header bar implementation. | 6 * @fileoverview Login UI header bar implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('login', function() { | 9 cr.define('login', function() { |
10 /** | 10 /** |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 }); | 309 }); |
310 // Guard timer for 2 seconds + 200 ms + epsilon. | 310 // Guard timer for 2 seconds + 200 ms + epsilon. |
311 ensureTransitionEndEvent(launcher, 2250); | 311 ensureTransitionEndEvent(launcher, 2250); |
312 | 312 |
313 this.classList.remove('login-header-bar-animate-slow'); | 313 this.classList.remove('login-header-bar-animate-slow'); |
314 this.classList.add('login-header-bar-animate-fast'); | 314 this.classList.add('login-header-bar-animate-fast'); |
315 this.classList.add('login-header-bar-hidden'); | 315 this.classList.add('login-header-bar-hidden'); |
316 }, | 316 }, |
317 | 317 |
318 /** | 318 /** |
319 * Animates Header bar to slowly appear on the screen. | 319 * Animates Header bar to appear on the screen. |
320 * | 320 * |
| 321 * @param {boolean} fast Whether the animation should complete quickly or |
| 322 * slowly. |
321 * @param {function()} callback will be called once animation is finished. | 323 * @param {function()} callback will be called once animation is finished. |
322 */ | 324 */ |
323 animateIn: function(callback) { | 325 animateIn: function(fast, callback) { |
324 if (callback) { | 326 if (callback) { |
325 var launcher = this; | 327 var launcher = this; |
326 launcher.addEventListener( | 328 launcher.addEventListener( |
327 'webkitTransitionEnd', function f(e) { | 329 'webkitTransitionEnd', function f(e) { |
328 launcher.removeEventListener('webkitTransitionEnd', f); | 330 launcher.removeEventListener('webkitTransitionEnd', f); |
329 callback(); | 331 callback(); |
330 }); | 332 }); |
331 // Guard timer for 2 seconds + 200 ms + epsilon. | 333 // Guard timer for 2 seconds + 200 ms + epsilon. |
332 ensureTransitionEndEvent(launcher, 2250); | 334 ensureTransitionEndEvent(launcher, 2250); |
333 } | 335 } |
334 | 336 |
335 if (Oobe.getInstance().displayType == DISPLAY_TYPE.OOBE) { | 337 if (fast) { |
336 this.classList.remove('login-header-bar-animate-slow'); | 338 this.classList.remove('login-header-bar-animate-slow'); |
337 this.classList.add('login-header-bar-animate-fast'); | 339 this.classList.add('login-header-bar-animate-fast'); |
338 } else { | 340 } else { |
339 this.classList.remove('login-header-bar-animate-fast'); | 341 this.classList.remove('login-header-bar-animate-fast'); |
340 this.classList.add('login-header-bar-animate-slow'); | 342 this.classList.add('login-header-bar-animate-slow'); |
341 } | 343 } |
342 | 344 |
343 this.classList.remove('login-header-bar-hidden'); | 345 this.classList.remove('login-header-bar-hidden'); |
344 }, | 346 }, |
345 }; | 347 }; |
346 | 348 |
347 /** | 349 /** |
348 * Convenience wrapper of animateOut. | 350 * Convenience wrapper of animateOut. |
349 */ | 351 */ |
350 HeaderBar.animateOut = function(callback) { | 352 HeaderBar.animateOut = function(callback) { |
351 $('login-header-bar').animateOut(callback); | 353 $('login-header-bar').animateOut(callback); |
352 }; | 354 }; |
353 | 355 |
354 /** | 356 /** |
355 * Convenience wrapper of animateIn. | 357 * Convenience wrapper of animateIn. |
356 */ | 358 */ |
357 HeaderBar.animateIn = function(callback) { | 359 HeaderBar.animateIn = function(fast, callback) { |
358 $('login-header-bar').animateIn(callback); | 360 $('login-header-bar').animateIn(fast, callback); |
359 }; | 361 }; |
360 | 362 |
361 return { | 363 return { |
362 HeaderBar: HeaderBar | 364 HeaderBar: HeaderBar |
363 }; | 365 }; |
364 }); | 366 }); |
OLD | NEW |