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 'runAppForTesting', |
| 27 'setApps', |
| 28 'showAppError', |
26 'updateUserImage', | 29 'updateUserImage', |
27 'forceOnlineSignin', | 30 'forceOnlineSignin', |
28 'setCapsLockState', | 31 'setCapsLockState', |
29 'forceLockedUserPodFocus', | 32 'forceLockedUserPodFocus', |
30 'removeUser', | 33 'removeUser', |
31 'showBannerMessage', | 34 'showBannerMessage', |
32 'showUserPodButton', | 35 'showUserPodButton', |
33 ], | 36 ], |
34 | 37 |
35 preferredWidth_: 0, | 38 preferredWidth_: 0, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // initially focused. | 178 // initially focused. |
176 var hash = window.location.hash; | 179 var hash = window.location.hash; |
177 if (hash) { | 180 if (hash) { |
178 var podIndex = hash.substr(1); | 181 var podIndex = hash.substr(1); |
179 if (podIndex) | 182 if (podIndex) |
180 $('pod-row').focusPodByIndex(podIndex, false); | 183 $('pod-row').focusPodByIndex(podIndex, false); |
181 } | 184 } |
182 }, | 185 }, |
183 | 186 |
184 /** | 187 /** |
| 188 * Runs app with a given id from the list of loaded apps. |
| 189 * @param {!string} app_id of an app to run. |
| 190 * @param {boolean=} opt_diagnostic_mode Whether to run the app in |
| 191 * diagnostic mode. Default is false. |
| 192 */ |
| 193 runAppForTesting: function(app_id, opt_diagnostic_mode) { |
| 194 $('pod-row').findAndRunAppForTesting(app_id, opt_diagnostic_mode); |
| 195 }, |
| 196 |
| 197 /** |
| 198 * Adds given apps to the pod row. |
| 199 * @param {array} apps Array of apps. |
| 200 */ |
| 201 setApps: function(apps) { |
| 202 $('pod-row').setApps(apps); |
| 203 }, |
| 204 |
| 205 /** |
| 206 * Shows the given kiosk app error message. |
| 207 * @param {!string} message Error message to show. |
| 208 */ |
| 209 showAppError: function(message) { |
| 210 // TODO(nkostylev): Figure out a way to show kiosk app launch error |
| 211 // pointing to the kiosk app pod. |
| 212 /** @const */ var BUBBLE_PADDING = 12; |
| 213 $('bubble').showTextForElement($('pod-row'), |
| 214 message, |
| 215 cr.ui.Bubble.Attachment.BOTTOM, |
| 216 $('pod-row').offsetWidth / 2, |
| 217 BUBBLE_PADDING); |
| 218 }, |
| 219 |
| 220 /** |
185 * Updates current image of a user. | 221 * Updates current image of a user. |
186 * @param {string} username User for which to update the image. | 222 * @param {string} username User for which to update the image. |
187 */ | 223 */ |
188 updateUserImage: function(username) { | 224 updateUserImage: function(username) { |
189 $('pod-row').updateUserImage(username); | 225 $('pod-row').updateUserImage(username); |
190 }, | 226 }, |
191 | 227 |
192 /** | 228 /** |
193 * Indicates that the given user must authenticate against GAIA during the | 229 * Indicates that the given user must authenticate against GAIA during the |
194 * next sign-in. | 230 * next sign-in. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 * is used by the chrome.screenlockPrivate API. | 276 * is used by the chrome.screenlockPrivate API. |
241 * @param {string} username Username of pod to add button | 277 * @param {string} username Username of pod to add button |
242 * @param {string} iconURL URL of the button icon | 278 * @param {string} iconURL URL of the button icon |
243 */ | 279 */ |
244 showUserPodButton: function(username, iconURL) { | 280 showUserPodButton: function(username, iconURL) { |
245 $('pod-row').showUserPodButton(username, iconURL); | 281 $('pod-row').showUserPodButton(username, iconURL); |
246 } | 282 } |
247 }; | 283 }; |
248 }); | 284 }); |
249 | 285 |
OLD | NEW |