OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 Account picker screen implementation. | 6 * @fileoverview Account picker screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('login', function() { | 9 cr.define('login', function() { |
10 /** | 10 /** |
(...skipping 21 matching lines...) Expand all Loading... |
32 }, | 32 }, |
33 | 33 |
34 // Whether this screen is shown for the first time. | 34 // Whether this screen is shown for the first time. |
35 firstShown_ : true, | 35 firstShown_ : true, |
36 | 36 |
37 /** | 37 /** |
38 * Event handler that is invoked just before the frame is shown. | 38 * Event handler that is invoked just before the frame is shown. |
39 * @param data {string} Screen init payload. | 39 * @param data {string} Screen init payload. |
40 */ | 40 */ |
41 onBeforeShow: function(data) { | 41 onBeforeShow: function(data) { |
42 $('add-user-header-bar-item').hidden = false; | 42 var podRow = $('pod-row'); |
43 $('pod-row').handleShow(); | 43 podRow.handleShow(); |
| 44 |
| 45 // If this is showing for the lock screen display the sign out button, |
| 46 // hide the add user button and activate the locked user's pod. |
| 47 var lockedPod = podRow.lockedPod; |
| 48 $('add-user-header-bar-item').hidden = !!lockedPod; |
| 49 $('sign-out-user-item').hidden = !lockedPod; |
| 50 if (lockedPod) |
| 51 podRow.focusPod(lockedPod); |
| 52 |
44 if (this.firstShown_) { | 53 if (this.firstShown_) { |
45 this.firstShown_ = false; | 54 this.firstShown_ = false; |
46 // TODO(nkostylev): Enable animation back when session start jank | 55 // TODO(nkostylev): Enable animation back when session start jank |
47 // is reduced. See http://crosbug.com/11116 http://crosbug.com/18307 | 56 // is reduced. See http://crosbug.com/11116 http://crosbug.com/18307 |
48 // $('pod-row').startInitAnimation(); | 57 // $('pod-row').startInitAnimation(); |
49 | 58 |
50 // TODO(altimofeev): Call it after animation has stoped when animation | 59 // TODO(altimofeev): Call it after animation has stoped when animation |
51 // is enabled. | 60 // is enabled. |
52 chrome.send('accountPickerReady', []); | 61 chrome.send('accountPickerReady', []); |
53 } | 62 } |
54 }, | 63 }, |
55 | 64 |
56 /** | 65 /** |
57 * Event handler that is invoked just before the frame is hidden. | 66 * Event handler that is invoked just before the frame is hidden. |
58 * @param data {string} Screen init payload. | 67 * @param data {string} Screen init payload. |
59 */ | 68 */ |
60 onBeforeHide: function(data) { | 69 onBeforeHide: function(data) { |
61 $('pod-row').handleHide(); | 70 $('pod-row').handleHide(); |
62 } | 71 } |
63 }; | 72 }; |
64 | 73 |
65 /** | 74 /** |
66 * Loads givens users in pod row. | 75 * Loads givens users in pod row. |
67 * @param {array} users Array of user. | 76 * @param {array} users Array of user. |
68 * @param {boolean} animated Whether to use init animation. | 77 * @param {boolean} animated Whether to use init animation. |
69 * @public | 78 * @public |
70 */ | 79 */ |
71 AccountPickerScreen.loadUsers = function(users, animated) { | 80 AccountPickerScreen.loadUsers = function(users, animated) { |
72 $('pod-row').loadPods(users, animated); | 81 $('pod-row').loadPods(users, animated); |
73 | |
74 // If this is showing for the lock screen display the sign out button, hide | |
75 // the add user button and activate the locked user's pod. | |
76 var lockedPod = $('pod-row').lockedPod; | |
77 $('add-user-header-bar-item').hidden = !!lockedPod; | |
78 $('sign-out-user-item').hidden = !lockedPod; | |
79 if (lockedPod) | |
80 lockedPod.activate(); | |
81 }; | 82 }; |
82 | 83 |
83 /** | 84 /** |
84 * Updates current image of a user. | 85 * Updates current image of a user. |
85 * @param {string} email Email of the user for which to update the image. | 86 * @param {string} email Email of the user for which to update the image. |
86 * @public | 87 * @public |
87 */ | 88 */ |
88 AccountPickerScreen.updateUserImage = function(email) { | 89 AccountPickerScreen.updateUserImage = function(email) { |
89 console.log('updateUserImage ' + email); | 90 console.log('updateUserImage ' + email); |
90 $('pod-row').updateUserImage(email); | 91 $('pod-row').updateUserImage(email); |
91 }; | 92 }; |
92 | 93 |
93 /** | 94 /** |
94 * Updates Caps Lock state (for Caps Lock hint in password input field). | 95 * Updates Caps Lock state (for Caps Lock hint in password input field). |
95 * @param {boolean} enabled Whether Caps Lock is on. | 96 * @param {boolean} enabled Whether Caps Lock is on. |
96 * @public | 97 * @public |
97 */ | 98 */ |
98 AccountPickerScreen.setCapsLockState = function(enabled) { | 99 AccountPickerScreen.setCapsLockState = function(enabled) { |
99 $('pod-row').classList[enabled ? 'add' : 'remove']('capslock-on'); | 100 $('pod-row').classList[enabled ? 'add' : 'remove']('capslock-on'); |
100 }; | 101 }; |
101 | 102 |
102 return { | 103 return { |
103 AccountPickerScreen: AccountPickerScreen | 104 AccountPickerScreen: AccountPickerScreen |
104 }; | 105 }; |
105 }); | 106 }); |
OLD | NEW |