Chromium Code Reviews| Index: chrome/browser/resources/user_chooser/user_chooser_common.js |
| diff --git a/chrome/browser/resources/user_chooser/user_chooser_common.js b/chrome/browser/resources/user_chooser/user_chooser_common.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7d4b2c7f626960d60d6ce5a20b7f980bc4400630 |
| --- /dev/null |
| +++ b/chrome/browser/resources/user_chooser/user_chooser_common.js |
| @@ -0,0 +1,127 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview This class is used only by the desktop account picker screen. |
| + * It defines a similar structure and set of functions as |
| + * chrome/browser/resources/chromeos/login/login_common.js, but only for |
| + * the account picker (i.e. ignoring the other CrOS OOBE screens) |
| + */ |
| +<include src="../chromeos/login/screen.js"></include> |
| +<include src="../chromeos/user_images_grid.js"></include> |
| +<include src="../chromeos/login/apps_menu.js"></include> |
|
Nikita (slow)
2013/06/11 18:43:28
These are specific to CrOS OOBE screens and should
noms
2013/06/12 20:41:54
Done.
|
| +<include src="../chromeos/login/bubble.js"></include> |
| +<include src="../chromeos/login/display_manager.js"></include> |
| +<include src="header_bar.js"></include> |
| +<include src="../chromeos/login/screen_account_picker.js"></include> |
| +<include src="../chromeos/login/screen_error_message.js"></include> |
| +<include src="../chromeos/login/oobe_screen_user_image.js"></include> |
| +<include src="../chromeos/login/screen_gaia_signin.js"></include> |
| +<include |
| + src="../chromeos/login/screen_locally_managed_user_creation.js"></include> |
|
Nikita (slow)
2013/06/11 18:43:28
nit: move </include> on next line instead?
noms
2013/06/12 20:41:54
Removed the include altogether :)
On 2013/06/11 18
|
| +<include src="../chromeos/login/screen_password_changed.js"></include> |
| +<include src="../chromeos/login/screen_tpm_error.js"></include> |
| +<include src="../chromeos/login/screen_wrong_hwid.js"></include> |
| +<include src="../chromeos/login/user_pod_row.js"></include> |
| + |
|
Nikita (slow)
2013/06/11 18:43:28
nit: drop empty line
noms
2013/06/12 20:41:54
Done.
|
| +<include src="../chromeos/login/resource_loader.js"></include> |
| + |
| +cr.define('cr.ui', function() { |
| + var DisplayManager = cr.ui.login.DisplayManager; |
| + |
| + /** |
| + * Constructs an Out of box controller. It manages initialization of screens, |
| + * transitions, error messages display. |
| + * @extends {DisplayManager} |
| + * @constructor |
| + */ |
| + function Oobe() { |
| + } |
| + |
| + cr.addSingletonGetter(Oobe); |
| + |
| + Oobe.prototype = { |
| + __proto__: DisplayManager.prototype, |
| + }; |
| + |
| + /** |
| + * Shows the given screen. |
| + * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data} |
| + */ |
| + Oobe.showUserChooserScreen = function() { |
| + Oobe.getInstance().showScreen({id: 'account-picker', |
| + data: {disableAddUser: false}}); |
| + // The ChromeOS account-picker will hide the AddUser button if a user is |
| + // logged in and the screen is "locked", so we must re-enabled it |
| + $('add-user-header-bar-item').hidden = false; |
| + |
| + // Ensure that the buttons we can't use are not being shown. |
| + $('sign-out-user-item').hidden = true; |
| + $('shutdown-header-bar-item').hidden = true; |
| + }; |
| + |
| + /** |
| + * Shows signin UI. |
| + * @param {string} opt_email An optional email for signin UI. |
| + */ |
| + Oobe.launchUser = function(email, displayName) { |
| + chrome.send('launchUser', [email, displayName]); |
| + }; |
| + |
| + /** |
| + * Disables signin UI. |
| + */ |
| + Oobe.disableSigninUI = function() { |
| + DisplayManager.disableSigninUI(); |
| + }; |
| + |
| + /** |
| + * Shows signin UI. |
| + * @param {string} opt_email An optional email for signin UI. |
| + */ |
| + Oobe.showSigninUI = function(opt_email) { |
| + DisplayManager.showSigninUI(opt_email); |
| + }; |
| + |
| + /** |
| + * Clears error bubble as well as optional menus that could be open. |
| + */ |
| + Oobe.clearErrors = function() { |
| + DisplayManager.clearErrors(); |
| + }; |
| + |
| + /** |
| + * Clears password field in user-pod. |
| + */ |
| + Oobe.clearUserPodPassword = function() { |
| + DisplayManager.clearUserPodPassword(); |
| + }; |
| + |
| + /** |
| + * Restores input focus to currently selected pod. |
| + */ |
| + Oobe.refocusCurrentPod = function() { |
| + DisplayManager.refocusCurrentPod(); |
| + }; |
| + |
| + // Export |
| + return { |
| + Oobe: Oobe |
| + }; |
| +}); |
| + |
| +var Oobe = cr.ui.Oobe; |
| + |
| +// Allow selection events on components with editable text (password field) |
| +// bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
| +disableTextSelectAndDrag(function(e) { |
| + var src = e.target; |
| + return src instanceof HTMLTextAreaElement || |
| + src instanceof HTMLInputElement && |
| + /text|password|search/.test(src.type); |
| +}); |
| + |
| +document.addEventListener('DOMContentLoaded', function() { |
| + 'use strict'; |
| +}); |