| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 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> |
| 11 |
| 12 cr.define('cr.ui', function() { |
| 13 var DisplayManager = cr.ui.login.DisplayManager; |
| 14 |
| 15 /** |
| 16 * Constructs an Out of box controller. It manages initialization of screens, |
| 17 * transitions, error messages display. |
| 18 * @extends {DisplayManager} |
| 19 * @constructor |
| 20 */ |
| 21 function Oobe() { |
| 22 } |
| 23 |
| 24 cr.addSingletonGetter(Oobe); |
| 25 |
| 26 Oobe.prototype = { |
| 27 __proto__: DisplayManager.prototype, |
| 28 }; |
| 29 |
| 30 /** |
| 31 * Shows the given screen. |
| 32 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data} |
| 33 */ |
| 34 Oobe.showUserChooserScreen = 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; |
| 40 }; |
| 41 |
| 42 /** |
| 43 * Shows signin UI. |
| 44 * @param {string} opt_email An optional email for signin UI. |
| 45 */ |
| 46 Oobe.launchUser = function(email, displayName) { |
| 47 chrome.send('launchUser', [email, displayName]); |
| 48 }; |
| 49 |
| 50 /** |
| 51 * Disables signin UI. |
| 52 */ |
| 53 Oobe.disableSigninUI = function() { |
| 54 DisplayManager.disableSigninUI(); |
| 55 }; |
| 56 |
| 57 /** |
| 58 * Shows signin UI. |
| 59 * @param {string} opt_email An optional email for signin UI. |
| 60 */ |
| 61 Oobe.showSigninUI = function(opt_email) { |
| 62 DisplayManager.showSigninUI(opt_email); |
| 63 }; |
| 64 |
| 65 /** |
| 66 * Clears error bubble as well as optional menus that could be open. |
| 67 */ |
| 68 Oobe.clearErrors = function() { |
| 69 DisplayManager.clearErrors(); |
| 70 }; |
| 71 |
| 72 /** |
| 73 * Clears password field in user-pod. |
| 74 */ |
| 75 Oobe.clearUserPodPassword = function() { |
| 76 DisplayManager.clearUserPodPassword(); |
| 77 }; |
| 78 |
| 79 /** |
| 80 * Restores input focus to currently selected pod. |
| 81 */ |
| 82 Oobe.refocusCurrentPod = function() { |
| 83 DisplayManager.refocusCurrentPod(); |
| 84 }; |
| 85 |
| 86 // Export |
| 87 return { |
| 88 Oobe: Oobe |
| 89 }; |
| 90 }); |
| 91 |
| 92 cr.define('UserChooser', function() { |
| 93 'use strict'; |
| 94 |
| 95 function initialize() { |
| 96 login.AccountPickerScreen.register(); |
| 97 cr.ui.Bubble.decorate($('bubble')); |
| 98 login.HeaderBar.decorate($('login-header-bar')); |
| 99 chrome.send('userChooserInitialize'); |
| 100 } |
| 101 |
| 102 // Return an object with all of the exports. |
| 103 return { |
| 104 initialize: initialize |
| 105 }; |
| 106 }); |
| 107 |
| 108 var Oobe = cr.ui.Oobe; |
| 109 |
| 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) { |
| 113 var src = e.target; |
| 114 return src instanceof HTMLTextAreaElement || |
| 115 src instanceof HTMLInputElement && |
| 116 /text|password|search/.test(src.type); |
| 117 }); |
| 118 |
| 119 document.addEventListener('DOMContentLoaded', UserChooser.initialize); |
| OLD | NEW |