1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 <include src="../chromeos/login/screen.js"></include>
5 <include src="../chromeos/login/bubble.js"></include>
6 <include src="../chromeos/login/display_manager.js"></include>
7 <include src="control_bar.js"></include>
8 <include src="../chromeos/login/screen_account_picker.js"></include>
9 <include src="../chromeos/login/user_pod_row.js"></include>
10 <include src="../chromeos/login/resource_loader.js"></include>
12 cr.define('cr.ui', function() {
13 var DisplayManager = cr.ui.login.DisplayManager;
16 * Constructs an Out of box controller. It manages initialization of screens,
17 * transitions, error messages display.
18 * @extends {DisplayManager}
24 cr.addSingletonGetter(Oobe);
27 __proto__: DisplayManager.prototype,
31 * Shows the given screen.
32 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data}
34 Oobe.showUserManagerScreen = function() {
35 Oobe.getInstance().showScreen({id: 'account-picker',
36 data: {disableAddUser: false}});
37 // The ChromeOS account-picker will hide the AddUser button if a user is
38 // logged in and the screen is "locked", so we must re-enabled it
39 $('add-user-header-bar-item').hidden = false;
44 * @param {string} opt_email An optional email for signin UI.
46 Oobe.launchUser = function(email, displayName) {
47 chrome.send('launchUser', [email, displayName]);
53 Oobe.disableSigninUI = function() {
54 DisplayManager.disableSigninUI();
59 * @param {string} opt_email An optional email for signin UI.
61 Oobe.showSigninUI = function(opt_email) {
62 DisplayManager.showSigninUI(opt_email);
66 * Clears error bubble as well as optional menus that could be open.
68 Oobe.clearErrors = function() {
69 DisplayManager.clearErrors();
73 * Clears password field in user-pod.
75 Oobe.clearUserPodPassword = function() {
76 DisplayManager.clearUserPodPassword();
80 * Restores input focus to currently selected pod.
82 Oobe.refocusCurrentPod = function() {
83 DisplayManager.refocusCurrentPod();
92 cr.define('UserManager', function() {
95 function initialize() {
96 login.AccountPickerScreen.register();
97 cr.ui.Bubble.decorate($('bubble'));
98 login.HeaderBar.decorate($('login-header-bar'));
99 chrome.send('userManagerInitialize');
102 // Return an object with all of the exports.
104 initialize: initialize
108 var Oobe = cr.ui.Oobe;
110 // Allow selection events on components with editable text (password field)
111 // bug (http://code.google.com/p/chromium/issues/detail?id=125863)
112 disableTextSelectAndDrag(function(e) {
114 return src instanceof HTMLTextAreaElement ||
115 src instanceof HTMLInputElement &&
116 /text|password|search/.test(src.type);
119 document.addEventListener('DOMContentLoaded', UserManager.initialize);