| 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 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 this.user.initialLocale, | 2362 this.user.initialLocale, |
| 2363 this.user.initialMultipleRecommendedLocales); | 2363 this.user.initialMultipleRecommendedLocales); |
| 2364 }, | 2364 }, |
| 2365 | 2365 |
| 2366 /** @override **/ | 2366 /** @override **/ |
| 2367 update: function() { | 2367 update: function() { |
| 2368 UserPod.prototype.update.call(this); | 2368 UserPod.prototype.update.call(this); |
| 2369 this.querySelector('.info').textContent = | 2369 this.querySelector('.info').textContent = |
| 2370 loadTimeData.getStringF('publicAccountInfoFormat', | 2370 loadTimeData.getStringF('publicAccountInfoFormat', |
| 2371 this.user_.enterpriseDomain); | 2371 this.user_.enterpriseDomain); |
| 2372 if (this.querySelector('.full-name')) |
| 2373 this.querySelector('.full-name').textContent = this.user_.displayName; |
| 2372 }, | 2374 }, |
| 2373 | 2375 |
| 2374 /** @override */ | 2376 /** @override */ |
| 2375 focusInput: function() { | 2377 focusInput: function() { |
| 2376 // Move tabIndex from the whole pod to the main input. | 2378 // Move tabIndex from the whole pod to the main input. |
| 2377 this.tabIndex = -1; | 2379 this.tabIndex = -1; |
| 2378 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; | 2380 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; |
| 2379 this.mainInput.focus(); | 2381 this.mainInput.focus(); |
| 2380 }, | 2382 }, |
| 2381 | 2383 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 } | 2450 } |
| 2449 chrome.send('launchHelpApp', [HELP_TOPIC_PUBLIC_SESSION]); | 2451 chrome.send('launchHelpApp', [HELP_TOPIC_PUBLIC_SESSION]); |
| 2450 stopEventPropagation(event); | 2452 stopEventPropagation(event); |
| 2451 }, | 2453 }, |
| 2452 | 2454 |
| 2453 /** | 2455 /** |
| 2454 * Transition the expanded pod from the basic to the advanced view. | 2456 * Transition the expanded pod from the basic to the advanced view. |
| 2455 */ | 2457 */ |
| 2456 transitionToAdvanced_: function() { | 2458 transitionToAdvanced_: function() { |
| 2457 this.classList.add('advanced'); | 2459 this.classList.add('advanced'); |
| 2458 // TODO(wzang): Add transition animation when its spec becomes available. | |
| 2459 }, | 2460 }, |
| 2460 | 2461 |
| 2461 /** | 2462 /** |
| 2462 * Show a dialog when user clicks on learn more (monitoring) button. | 2463 * Show a dialog when user clicks on learn more (monitoring) button. |
| 2463 */ | 2464 */ |
| 2464 onMonitoringLearnMoreClicked_: function() { | 2465 onMonitoringLearnMoreClicked_: function() { |
| 2465 if (!this.dialogContainer_) { | 2466 if (!this.dialogContainer_) { |
| 2466 this.dialogContainer_ = document.createElement('div'); | 2467 this.dialogContainer_ = document.createElement('div'); |
| 2467 this.dialogContainer_.classList.add('monitoring-dialog-container'); | 2468 this.dialogContainer_.classList.add('monitoring-dialog-container'); |
| 2468 var topContainer = document.querySelector('#scroll-container'); | 2469 var topContainer = document.querySelector('#scroll-container'); |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3901 // long names don't exceed maximum pod width. | 3902 // long names don't exceed maximum pod width. |
| 3902 var nameArea = pod.querySelector('.name-container'); | 3903 var nameArea = pod.querySelector('.name-container'); |
| 3903 var leftMargin = (CROS_POD_WIDTH - pod.nameElement.offsetWidth) / 2; | 3904 var leftMargin = (CROS_POD_WIDTH - pod.nameElement.offsetWidth) / 2; |
| 3904 if (leftMargin > 0) { | 3905 if (leftMargin > 0) { |
| 3905 nameArea.style.left = cr.ui.toCssPx(leftMargin); | 3906 nameArea.style.left = cr.ui.toCssPx(leftMargin); |
| 3906 nameArea.style.right = 'auto'; | 3907 nameArea.style.right = 'auto'; |
| 3907 } else { | 3908 } else { |
| 3908 pod.nameElement.style.width = cr.ui.toCssPx(CROS_POD_WIDTH); | 3909 pod.nameElement.style.width = cr.ui.toCssPx(CROS_POD_WIDTH); |
| 3909 nameArea.style.left = cr.ui.toCssPx(0); | 3910 nameArea.style.left = cr.ui.toCssPx(0); |
| 3910 nameArea.style.right = 'auto'; | 3911 nameArea.style.right = 'auto'; |
| 3912 // For public session pods whose names are cut off, add a banner |
| 3913 // which shows the full name upon hovering. |
| 3914 if (pod.isPublicSessionPod && !pod.querySelector('.full-name')) { |
| 3915 var fullNameContainer = document.createElement('div'); |
| 3916 fullNameContainer.classList.add('full-name'); |
| 3917 fullNameContainer.textContent = pod.nameElement.textContent; |
| 3918 nameArea.appendChild(fullNameContainer); |
| 3919 } |
| 3911 } | 3920 } |
| 3912 | 3921 |
| 3913 // Update info container area for public session pods. | 3922 // Update info container area for public session pods. |
| 3914 if (pod.isPublicSessionPod) { | 3923 if (pod.isPublicSessionPod) { |
| 3915 var infoElement = pod.querySelector('.info'); | 3924 var infoElement = pod.querySelector('.info'); |
| 3916 var infoIcon = pod.querySelector('.learn-more'); | 3925 var infoIcon = pod.querySelector('.learn-more'); |
| 3917 var totalWidth = PUBLIC_SESSION_ICON_WIDTH + infoElement.offsetWidth; | 3926 var totalWidth = PUBLIC_SESSION_ICON_WIDTH + infoElement.offsetWidth; |
| 3918 var infoLeftMargin = (CROS_POD_WIDTH - totalWidth) / 2; | 3927 var infoLeftMargin = (CROS_POD_WIDTH - totalWidth) / 2; |
| 3919 if (infoLeftMargin > 0) { | 3928 if (infoLeftMargin > 0) { |
| 3920 infoIcon.style.left = cr.ui.toCssPx(infoLeftMargin); | 3929 infoIcon.style.left = cr.ui.toCssPx(infoLeftMargin); |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4697 if (pod && pod.multiProfilesPolicyApplied) { | 4706 if (pod && pod.multiProfilesPolicyApplied) { |
| 4698 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 4707 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 4699 } | 4708 } |
| 4700 } | 4709 } |
| 4701 }; | 4710 }; |
| 4702 | 4711 |
| 4703 return { | 4712 return { |
| 4704 PodRow: PodRow | 4713 PodRow: PodRow |
| 4705 }; | 4714 }; |
| 4706 }); | 4715 }); |
| OLD | NEW |