OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 User pod row implementation. | 6 * @fileoverview User pod row implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('login', function() { | 9 cr.define('login', function() { |
10 /** | 10 /** |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 /** | 338 /** |
339 * Hides the icon using a fade-out animation. | 339 * Hides the icon using a fade-out animation. |
340 */ | 340 */ |
341 fadeOut: function() { | 341 fadeOut: function() { |
342 // The icon is already being hidden. | 342 // The icon is already being hidden. |
343 if (this.iconElement.classList.contains('faded')) | 343 if (this.iconElement.classList.contains('faded')) |
344 return; | 344 return; |
345 | 345 |
346 this.hideTooltip_(true); | 346 this.hideTooltip_(true); |
347 this.iconElement.classList.add('faded'); | 347 this.iconElement.classList.add('faded'); |
348 this.hideTransitionListener_ = this.hide_.bind(this); | 348 this.hideTransitionListener_ = this.hide.bind(this); |
349 this.iconElement.addEventListener('webkitTransitionEnd', | 349 this.iconElement.addEventListener('webkitTransitionEnd', |
350 this.hideTransitionListener_); | 350 this.hideTransitionListener_); |
351 ensureTransitionEndEvent(this.iconElement, 200); | 351 ensureTransitionEndEvent(this.iconElement, 200); |
352 }, | 352 }, |
353 | 353 |
354 /** | 354 /** |
355 * Sets the icon size element size. | 355 * Sets the icon size element size. |
356 * @param {!{width: number, height: number}} size The icon size. | 356 * @param {!{width: number, height: number}} size The icon size. |
357 */ | 357 */ |
358 setSize: function(size) { | 358 setSize: function(size) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 this.iconElement.removeAttribute('tabIndex'); | 460 this.iconElement.removeAttribute('tabIndex'); |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 // Set the new action handler. | 464 // Set the new action handler. |
465 this.actionHandler_ = callback; | 465 this.actionHandler_ = callback; |
466 }, | 466 }, |
467 | 467 |
468 /** | 468 /** |
469 * Hides the icon. Makes sure the tooltip is hidden and animation reset. | 469 * Hides the icon. Makes sure the tooltip is hidden and animation reset. |
470 * @private | |
471 */ | 470 */ |
472 hide_: function() { | 471 hide: function() { |
473 this.hideTooltip_(true); | 472 this.hideTooltip_(true); |
474 this.hidden = true; | 473 this.hidden = true; |
475 this.setAnimation(null); | 474 this.setAnimation(null); |
476 this.setInteractive(null); | 475 this.setInteractive(null); |
477 this.resetHideTransitionState_(); | 476 this.resetHideTransitionState_(); |
478 }, | 477 }, |
479 | 478 |
480 /** | 479 /** |
481 * Ensures the icon's transition state potentially set by a call to | 480 * Ensures the icon's transition state potentially set by a call to |
482 * {@code fadeOut} is cleared. | 481 * {@code fadeOut} is cleared. |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 * @param {string} username Username of pod to remove button | 2350 * @param {string} username Username of pod to remove button |
2352 */ | 2351 */ |
2353 hideUserPodCustomIcon: function(username) { | 2352 hideUserPodCustomIcon: function(username) { |
2354 var pod = this.getPodWithUsername_(username); | 2353 var pod = this.getPodWithUsername_(username); |
2355 if (pod == null) { | 2354 if (pod == null) { |
2356 console.error('Unable to hide user pod button for ' + username + | 2355 console.error('Unable to hide user pod button for ' + username + |
2357 ': user pod not found.'); | 2356 ': user pod not found.'); |
2358 return; | 2357 return; |
2359 } | 2358 } |
2360 | 2359 |
2361 pod.customIconElement.fadeOut(); | 2360 // TODO(tengs): Allow option for a fading transition. |
| 2361 pod.customIconElement.hide(); |
2362 }, | 2362 }, |
2363 | 2363 |
2364 /** | 2364 /** |
2365 * Sets the authentication type used to authenticate the user. | 2365 * Sets the authentication type used to authenticate the user. |
2366 * @param {string} username Username of selected user | 2366 * @param {string} username Username of selected user |
2367 * @param {number} authType Authentication type, must be one of the | 2367 * @param {number} authType Authentication type, must be one of the |
2368 * values listed in AUTH_TYPE enum. | 2368 * values listed in AUTH_TYPE enum. |
2369 * @param {string} value The initial value to use for authentication. | 2369 * @param {string} value The initial value to use for authentication. |
2370 */ | 2370 */ |
2371 setAuthType: function(username, authType, value) { | 2371 setAuthType: function(username, authType, value) { |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3002 if (pod && pod.multiProfilesPolicyApplied) { | 3002 if (pod && pod.multiProfilesPolicyApplied) { |
3003 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3003 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
3004 } | 3004 } |
3005 } | 3005 } |
3006 }; | 3006 }; |
3007 | 3007 |
3008 return { | 3008 return { |
3009 PodRow: PodRow | 3009 PodRow: PodRow |
3010 }; | 3010 }; |
3011 }); | 3011 }); |
OLD | NEW |