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 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 | 2420 |
2421 this.shouldShowApps_ = shouldShowApps; | 2421 this.shouldShowApps_ = shouldShowApps; |
2422 this.rebuildPods(); | 2422 this.rebuildPods(); |
2423 }, | 2423 }, |
2424 | 2424 |
2425 /** | 2425 /** |
2426 * Shows a custom icon on a user pod besides the input field. | 2426 * Shows a custom icon on a user pod besides the input field. |
2427 * @param {string} username Username of pod to add button | 2427 * @param {string} username Username of pod to add button |
2428 * @param {!{id: !string, | 2428 * @param {!{id: !string, |
2429 * hardlockOnClick: boolean, | 2429 * hardlockOnClick: boolean, |
| 2430 * isTrialRun: boolean, |
2430 * ariaLabel: string | undefined, | 2431 * ariaLabel: string | undefined, |
2431 * tooltip: ({text: string, autoshow: boolean} | undefined)}} icon | 2432 * tooltip: ({text: string, autoshow: boolean} | undefined)}} icon |
2432 * The icon parameters. | 2433 * The icon parameters. |
2433 */ | 2434 */ |
2434 showUserPodCustomIcon: function(username, icon) { | 2435 showUserPodCustomIcon: function(username, icon) { |
2435 var pod = this.getPodWithUsername_(username); | 2436 var pod = this.getPodWithUsername_(username); |
2436 if (pod == null) { | 2437 if (pod == null) { |
2437 console.error('Unable to show user pod button for ' + username + | 2438 console.error('Unable to show user pod button for ' + username + |
2438 ': user pod not found.'); | 2439 ': user pod not found.'); |
2439 return; | 2440 return; |
2440 } | 2441 } |
2441 | 2442 |
2442 if (!icon.id && !icon.tooltip) | 2443 if (!icon.id && !icon.tooltip) |
2443 return; | 2444 return; |
2444 | 2445 |
2445 if (icon.id) | 2446 if (icon.id) |
2446 pod.customIconElement.setIcon(icon.id); | 2447 pod.customIconElement.setIcon(icon.id); |
2447 | 2448 |
2448 if (icon.hardlockOnClick) { | 2449 if (icon.isTrialRun) { |
| 2450 pod.customIconElement.setInteractive( |
| 2451 this.onDidClickLockIconDuringTrialRun_.bind(this, username)); |
| 2452 } else if (icon.hardlockOnClick) { |
2449 pod.customIconElement.setInteractive( | 2453 pod.customIconElement.setInteractive( |
2450 this.hardlockUserPod_.bind(this, username)); | 2454 this.hardlockUserPod_.bind(this, username)); |
2451 } else { | 2455 } else { |
2452 pod.customIconElement.setInteractive(null); | 2456 pod.customIconElement.setInteractive(null); |
2453 } | 2457 } |
2454 | 2458 |
2455 var ariaLabel = icon.ariaLabel || (icon.tooltip && icon.tooltip.text); | 2459 var ariaLabel = icon.ariaLabel || (icon.tooltip && icon.tooltip.text); |
2456 if (ariaLabel) | 2460 if (ariaLabel) |
2457 pod.customIconElement.setAriaLabel(ariaLabel); | 2461 pod.customIconElement.setAriaLabel(ariaLabel); |
2458 else | 2462 else |
(...skipping 12 matching lines...) Expand all Loading... |
2471 * only unlocked using password, and the authentication type cannot be | 2475 * only unlocked using password, and the authentication type cannot be |
2472 * changed. | 2476 * changed. |
2473 * @param {!string} username The user's username. | 2477 * @param {!string} username The user's username. |
2474 * @private | 2478 * @private |
2475 */ | 2479 */ |
2476 hardlockUserPod_: function(username) { | 2480 hardlockUserPod_: function(username) { |
2477 chrome.send('hardlockPod', [username]); | 2481 chrome.send('hardlockPod', [username]); |
2478 }, | 2482 }, |
2479 | 2483 |
2480 /** | 2484 /** |
| 2485 * Records a metric indicating that the user clicked on the lock icon during |
| 2486 * the trial run for Easy Unlock. |
| 2487 * @param {!string} username The user's username. |
| 2488 * @private |
| 2489 */ |
| 2490 onDidClickLockIconDuringTrialRun_: function(username) { |
| 2491 chrome.send('recordClickOnLockIcon', [username]); |
| 2492 }, |
| 2493 |
| 2494 /** |
2481 * Hides the custom icon in the user pod added by showUserPodCustomIcon(). | 2495 * Hides the custom icon in the user pod added by showUserPodCustomIcon(). |
2482 * @param {string} username Username of pod to remove button | 2496 * @param {string} username Username of pod to remove button |
2483 */ | 2497 */ |
2484 hideUserPodCustomIcon: function(username) { | 2498 hideUserPodCustomIcon: function(username) { |
2485 var pod = this.getPodWithUsername_(username); | 2499 var pod = this.getPodWithUsername_(username); |
2486 if (pod == null) { | 2500 if (pod == null) { |
2487 console.error('Unable to hide user pod button for ' + username + | 2501 console.error('Unable to hide user pod button for ' + username + |
2488 ': user pod not found.'); | 2502 ': user pod not found.'); |
2489 return; | 2503 return; |
2490 } | 2504 } |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 if (pod && pod.multiProfilesPolicyApplied) { | 3145 if (pod && pod.multiProfilesPolicyApplied) { |
3132 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3146 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
3133 } | 3147 } |
3134 } | 3148 } |
3135 }; | 3149 }; |
3136 | 3150 |
3137 return { | 3151 return { |
3138 PodRow: PodRow | 3152 PodRow: PodRow |
3139 }; | 3153 }; |
3140 }); | 3154 }); |
OLD | NEW |