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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 }, | 348 }, |
349 | 349 |
350 /** | 350 /** |
351 * Animates Header bar to hide from the screen. | 351 * Animates Header bar to hide from the screen. |
352 * | 352 * |
353 * @param {function()} callback will be called once animation is finished. | 353 * @param {function()} callback will be called once animation is finished. |
354 */ | 354 */ |
355 animateOut: function(callback) { | 355 animateOut: function(callback) { |
356 var launcher = this; | 356 var launcher = this; |
357 launcher.addEventListener( | 357 launcher.addEventListener( |
358 'webkitTransitionEnd', function f(e) { | 358 'transitionend', function f(e) { |
359 launcher.removeEventListener('webkitTransitionEnd', f); | 359 launcher.removeEventListener('transitionend', f); |
360 callback(); | 360 callback(); |
361 }); | 361 }); |
362 // Guard timer for 2 seconds + 200 ms + epsilon. | 362 // Guard timer for 2 seconds + 200 ms + epsilon. |
363 ensureTransitionEndEvent(launcher, 2250); | 363 ensureTransitionEndEvent(launcher, 2250); |
364 | 364 |
365 this.classList.remove('login-header-bar-animate-slow'); | 365 this.classList.remove('login-header-bar-animate-slow'); |
366 this.classList.add('login-header-bar-animate-fast'); | 366 this.classList.add('login-header-bar-animate-fast'); |
367 this.classList.add('login-header-bar-hidden'); | 367 this.classList.add('login-header-bar-hidden'); |
368 }, | 368 }, |
369 | 369 |
370 /** | 370 /** |
371 * Animates Header bar to appear on the screen. | 371 * Animates Header bar to appear on the screen. |
372 * | 372 * |
373 * @param {boolean} fast Whether the animation should complete quickly or | 373 * @param {boolean} fast Whether the animation should complete quickly or |
374 * slowly. | 374 * slowly. |
375 * @param {function()} callback will be called once animation is finished. | 375 * @param {function()} callback will be called once animation is finished. |
376 */ | 376 */ |
377 animateIn: function(fast, callback) { | 377 animateIn: function(fast, callback) { |
378 if (callback) { | 378 if (callback) { |
379 var launcher = this; | 379 var launcher = this; |
380 launcher.addEventListener( | 380 launcher.addEventListener( |
381 'webkitTransitionEnd', function f(e) { | 381 'transitionend', function f(e) { |
382 launcher.removeEventListener('webkitTransitionEnd', f); | 382 launcher.removeEventListener('transitionend', f); |
383 callback(); | 383 callback(); |
384 }); | 384 }); |
385 // Guard timer for 2 seconds + 200 ms + epsilon. | 385 // Guard timer for 2 seconds + 200 ms + epsilon. |
386 ensureTransitionEndEvent(launcher, 2250); | 386 ensureTransitionEndEvent(launcher, 2250); |
387 } | 387 } |
388 | 388 |
389 if (fast) { | 389 if (fast) { |
390 this.classList.remove('login-header-bar-animate-slow'); | 390 this.classList.remove('login-header-bar-animate-slow'); |
391 this.classList.add('login-header-bar-animate-fast'); | 391 this.classList.add('login-header-bar-animate-fast'); |
392 } else { | 392 } else { |
(...skipping 16 matching lines...) Expand all Loading... |
409 * Convenience wrapper of animateIn. | 409 * Convenience wrapper of animateIn. |
410 */ | 410 */ |
411 HeaderBar.animateIn = function(fast, callback) { | 411 HeaderBar.animateIn = function(fast, callback) { |
412 $('login-header-bar').animateIn(fast, callback); | 412 $('login-header-bar').animateIn(fast, callback); |
413 }; | 413 }; |
414 | 414 |
415 return { | 415 return { |
416 HeaderBar: HeaderBar | 416 HeaderBar: HeaderBar |
417 }; | 417 }; |
418 }); | 418 }); |
OLD | NEW |