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

Side by Side Diff: ui/login/account_picker/user_pod_row.js

Issue 668213003: Reauthenticate the user before launching Smart Lock setup app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes + git cl format Created 6 years, 1 month 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
« no previous file with comments | « chrome/chrome_browser_chromeos.gypi ('k') | 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 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 {id: 'locked', class: 'custom-icon-locked'}, 193 {id: 'locked', class: 'custom-icon-locked'},
194 {id: 'unlocked', class: 'custom-icon-unlocked'}, 194 {id: 'unlocked', class: 'custom-icon-unlocked'},
195 {id: 'hardlocked', class: 'custom-icon-hardlocked'}, 195 {id: 'hardlocked', class: 'custom-icon-hardlocked'},
196 {id: 'spinner', class: 'custom-icon-spinner'} 196 {id: 'spinner', class: 'custom-icon-spinner'}
197 ]; 197 ];
198 198
199 UserPodCustomIcon.prototype = { 199 UserPodCustomIcon.prototype = {
200 __proto__: HTMLDivElement.prototype, 200 __proto__: HTMLDivElement.prototype,
201 201
202 /** 202 /**
203 * The id of the icon being shown.
204 * @type {string}
205 * @private
206 */
207 iconId_: '',
208
209 /**
203 * Tooltip to be shown when the user hovers over the icon. The icon 210 * Tooltip to be shown when the user hovers over the icon. The icon
204 * properties may be set so the tooltip is shown automatically when the icon 211 * properties may be set so the tooltip is shown automatically when the icon
205 * is updated. The tooltip is shown in a bubble attached to the icon 212 * is updated. The tooltip is shown in a bubble attached to the icon
206 * element. 213 * element.
207 * @type {string} 214 * @type {string}
208 * @private 215 * @private
209 */ 216 */
210 tooltip_: '', 217 tooltip_: '',
211 218
212 /** 219 /**
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return this.querySelector('.custom-icon'); 286 return this.querySelector('.custom-icon');
280 }, 287 },
281 288
282 /** 289 /**
283 * Updates the icon element class list to properly represent the provided 290 * Updates the icon element class list to properly represent the provided
284 * icon. 291 * icon.
285 * @param {!string} id The id of the icon that should be shown. Should be 292 * @param {!string} id The id of the icon that should be shown. Should be
286 * one of the ids listed in {@code UserPodCustomIcon.ICONS}. 293 * one of the ids listed in {@code UserPodCustomIcon.ICONS}.
287 */ 294 */
288 setIcon: function(id) { 295 setIcon: function(id) {
296 this.iconId_ = id;
289 UserPodCustomIcon.ICONS.forEach(function(icon) { 297 UserPodCustomIcon.ICONS.forEach(function(icon) {
290 this.iconElement.classList.toggle(icon.class, id == icon.id); 298 this.iconElement.classList.toggle(icon.class, id == icon.id);
291 }, this); 299 }, this);
292 }, 300 },
293 301
294 /** 302 /**
295 * Sets the ARIA label for the icon. 303 * Sets the ARIA label for the icon.
296 * @param {!string} ariaLabel 304 * @param {!string} ariaLabel
297 */ 305 */
298 setAriaLabel: function(ariaLabel) { 306 setAriaLabel: function(ariaLabel) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 478
471 // If autoshown bubble got hidden, clear the autoshown flag. 479 // If autoshown bubble got hidden, clear the autoshown flag.
472 if ($('bubble').hidden && this.tooltipAutoshown_) 480 if ($('bubble').hidden && this.tooltipAutoshown_)
473 this.tooltipAutoshown_ = false; 481 this.tooltipAutoshown_ = false;
474 482
475 // Show the tooltip bubble. 483 // Show the tooltip bubble.
476 var bubbleContent = document.createElement('div'); 484 var bubbleContent = document.createElement('div');
477 bubbleContent.textContent = this.tooltip_; 485 bubbleContent.textContent = this.tooltip_;
478 486
479 /** @const */ var BUBBLE_OFFSET = CUSTOM_ICON_CONTAINER_SIZE / 2; 487 /** @const */ var BUBBLE_OFFSET = CUSTOM_ICON_CONTAINER_SIZE / 2;
480 /** @const */ var BUBBLE_PADDING = 8; 488 // TODO(tengs): Introduce a special reauth state for the account picker,
489 // instead of showing the tooltip bubble here (crbug.com/409427).
490 /** @const */ var BUBBLE_PADDING = 8 + (this.iconId_ ? 0 : 23);
481 $('bubble').showContentForElement(this, 491 $('bubble').showContentForElement(this,
482 cr.ui.Bubble.Attachment.RIGHT, 492 cr.ui.Bubble.Attachment.RIGHT,
483 bubbleContent, 493 bubbleContent,
484 BUBBLE_OFFSET, 494 BUBBLE_OFFSET,
485 BUBBLE_PADDING); 495 BUBBLE_PADDING);
486 this.ensureTooltipTimeoutCleared_(); 496 this.ensureTooltipTimeoutCleared_();
487 this.tooltipActive_ = true; 497 this.tooltipActive_ = true;
488 }, 498 },
489 499
490 /** 500 /**
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 * The icon parameters. 2268 * The icon parameters.
2259 */ 2269 */
2260 showUserPodCustomIcon: function(username, icon) { 2270 showUserPodCustomIcon: function(username, icon) {
2261 var pod = this.getPodWithUsername_(username); 2271 var pod = this.getPodWithUsername_(username);
2262 if (pod == null) { 2272 if (pod == null) {
2263 console.error('Unable to show user pod button for ' + username + 2273 console.error('Unable to show user pod button for ' + username +
2264 ': user pod not found.'); 2274 ': user pod not found.');
2265 return; 2275 return;
2266 } 2276 }
2267 2277
2268 if (!icon.id) 2278 if (!icon.id && !icon.tooltip)
2269 return; 2279 return;
2270 2280
2271 pod.customIconElement.setIcon(icon.id); 2281 if (icon.id)
2282 pod.customIconElement.setIcon(icon.id);
2272 2283
2273 if (icon.hardlockOnClick) { 2284 if (icon.hardlockOnClick) {
2274 pod.customIconElement.setInteractive( 2285 pod.customIconElement.setInteractive(
2275 this.hardlockUserPod_.bind(this, username)); 2286 this.hardlockUserPod_.bind(this, username));
2276 } else { 2287 } else {
2277 pod.customIconElement.setInteractive(null); 2288 pod.customIconElement.setInteractive(null);
2278 } 2289 }
2279 2290
2280 var ariaLabel = icon.ariaLabel || (icon.tooltip && icon.tooltip.text); 2291 var ariaLabel = icon.ariaLabel || (icon.tooltip && icon.tooltip.text);
2281 if (ariaLabel) 2292 if (ariaLabel)
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 if (pod && pod.multiProfilesPolicyApplied) { 2970 if (pod && pod.multiProfilesPolicyApplied) {
2960 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 2971 pod.userTypeBubbleElement.classList.remove('bubble-shown');
2961 } 2972 }
2962 } 2973 }
2963 }; 2974 };
2964 2975
2965 return { 2976 return {
2966 PodRow: PodRow 2977 PodRow: PodRow
2967 }; 2978 };
2968 }); 2979 });
OLDNEW
« no previous file with comments | « chrome/chrome_browser_chromeos.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698