OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 login.createScreen('AccountPickerScreen', 'account-picker', function() { | 9 login.createScreen('AccountPickerScreen', 'account-picker', function() { |
10 /** | 10 /** |
11 * Maximum number of offline login failures before online login. | 11 * Maximum number of offline login failures before online login. |
12 * @type {number} | 12 * @type {number} |
13 * @const | 13 * @const |
14 */ | 14 */ |
15 var MAX_LOGIN_ATTEMPTS_IN_POD = 3; | 15 var MAX_LOGIN_ATTEMPTS_IN_POD = 3; |
16 /** | 16 /** |
17 * Whether to preselect the first pod automatically on login screen. | 17 * Whether to preselect the first pod automatically on login screen. |
18 * @type {boolean} | 18 * @type {boolean} |
19 * @const | 19 * @const |
20 */ | 20 */ |
21 var PRESELECT_FIRST_POD = true; | 21 var PRESELECT_FIRST_POD = true; |
22 | 22 |
23 return { | 23 return { |
24 EXTERNAL_API: [ | 24 EXTERNAL_API: [ |
25 'loadUsers', | 25 'loadUsers', |
| 26 'setApps', |
| 27 'showAppError', |
26 'updateUserImage', | 28 'updateUserImage', |
27 'forceOnlineSignin', | 29 'forceOnlineSignin', |
28 'setCapsLockState', | 30 'setCapsLockState', |
29 'forceLockedUserPodFocus', | 31 'forceLockedUserPodFocus', |
30 'removeUser', | 32 'removeUser', |
31 'showBannerMessage', | 33 'showBannerMessage', |
32 'showUserPodButton', | 34 'showUserPodButton', |
33 ], | 35 ], |
34 | 36 |
35 preferredWidth_: 0, | 37 preferredWidth_: 0, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // initially focused. | 177 // initially focused. |
176 var hash = window.location.hash; | 178 var hash = window.location.hash; |
177 if (hash) { | 179 if (hash) { |
178 var podIndex = hash.substr(1); | 180 var podIndex = hash.substr(1); |
179 if (podIndex) | 181 if (podIndex) |
180 $('pod-row').focusPodByIndex(podIndex, false); | 182 $('pod-row').focusPodByIndex(podIndex, false); |
181 } | 183 } |
182 }, | 184 }, |
183 | 185 |
184 /** | 186 /** |
| 187 * Adds given apps to the pod row. |
| 188 * @param {array} apps Array of apps. |
| 189 */ |
| 190 setApps: function(apps) { |
| 191 $('pod-row').setApps(apps); |
| 192 }, |
| 193 |
| 194 /** |
| 195 * Shows the given kiosk app error message. |
| 196 * @param {!string} message Error message to show. |
| 197 */ |
| 198 showAppError: function(message) { |
| 199 // TODO(nkostylev): Figure out a way to show kiosk app launch error |
| 200 // pointing to the kiosk app pod. |
| 201 /** @const */ var BUBBLE_PADDING = 12; |
| 202 $('bubble').showTextForElement($('pod-row'), |
| 203 message, |
| 204 cr.ui.Bubble.Attachment.BOTTOM, |
| 205 $('pod-row').offsetWidth / 2, |
| 206 BUBBLE_PADDING); |
| 207 }, |
| 208 |
| 209 /** |
185 * Updates current image of a user. | 210 * Updates current image of a user. |
186 * @param {string} username User for which to update the image. | 211 * @param {string} username User for which to update the image. |
187 */ | 212 */ |
188 updateUserImage: function(username) { | 213 updateUserImage: function(username) { |
189 $('pod-row').updateUserImage(username); | 214 $('pod-row').updateUserImage(username); |
190 }, | 215 }, |
191 | 216 |
192 /** | 217 /** |
193 * Indicates that the given user must authenticate against GAIA during the | 218 * Indicates that the given user must authenticate against GAIA during the |
194 * next sign-in. | 219 * next sign-in. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 * is used by the chrome.screenlockPrivate API. | 265 * is used by the chrome.screenlockPrivate API. |
241 * @param {string} username Username of pod to add button | 266 * @param {string} username Username of pod to add button |
242 * @param {string} iconURL URL of the button icon | 267 * @param {string} iconURL URL of the button icon |
243 */ | 268 */ |
244 showUserPodButton: function(username, iconURL) { | 269 showUserPodButton: function(username, iconURL) { |
245 $('pod-row').showUserPodButton(username, iconURL); | 270 $('pod-row').showUserPodButton(username, iconURL); |
246 } | 271 } |
247 }; | 272 }; |
248 }); | 273 }); |
249 | 274 |
OLD | NEW |