| OLD | NEW |
| (Empty) | |
| 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 |
| 5 /** |
| 6 * @fileoverview This class is used only by the desktop account picker screen. |
| 7 * It defines a similar structure and set of functions as |
| 8 * chrome/browser/resources/chromeos/login/login_common.js, but only for |
| 9 * the account picker (i.e. ignoring the other CrOS OOBE screens) |
| 10 */ |
| 11 <include src="../chromeos/login/screen.js"></include> |
| 12 <include src="../chromeos/login/bubble.js"></include> |
| 13 <include src="../chromeos/login/display_manager.js"></include> |
| 14 <include src="control_bar.js"></include> |
| 15 <include src="../chromeos/login/screen_account_picker.js"></include> |
| 16 <include src="../chromeos/login/user_pod_row.js"></include> |
| 17 <include src="../chromeos/login/resource_loader.js"></include> |
| 18 |
| 19 cr.define('cr.ui', function() { |
| 20 var DisplayManager = cr.ui.login.DisplayManager; |
| 21 |
| 22 /** |
| 23 * Constructs an Out of box controller. It manages initialization of screens, |
| 24 * transitions, error messages display. |
| 25 * @extends {DisplayManager} |
| 26 * @constructor |
| 27 */ |
| 28 function Oobe() { |
| 29 } |
| 30 |
| 31 cr.addSingletonGetter(Oobe); |
| 32 |
| 33 Oobe.prototype = { |
| 34 __proto__: DisplayManager.prototype, |
| 35 }; |
| 36 |
| 37 /** |
| 38 * Shows the given screen. |
| 39 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data} |
| 40 */ |
| 41 Oobe.showUserChooserScreen = function() { |
| 42 Oobe.getInstance().showScreen({id: 'account-picker', |
| 43 data: {disableAddUser: false}}); |
| 44 // The ChromeOS account-picker will hide the AddUser button if a user is |
| 45 // logged in and the screen is "locked", so we must re-enabled it |
| 46 $('add-user-header-bar-item').hidden = false; |
| 47 }; |
| 48 |
| 49 /** |
| 50 * Shows signin UI. |
| 51 * @param {string} opt_email An optional email for signin UI. |
| 52 */ |
| 53 Oobe.launchUser = function(email, displayName) { |
| 54 chrome.send('launchUser', [email, displayName]); |
| 55 }; |
| 56 |
| 57 /** |
| 58 * Disables signin UI. |
| 59 */ |
| 60 Oobe.disableSigninUI = function() { |
| 61 DisplayManager.disableSigninUI(); |
| 62 }; |
| 63 |
| 64 /** |
| 65 * Shows signin UI. |
| 66 * @param {string} opt_email An optional email for signin UI. |
| 67 */ |
| 68 Oobe.showSigninUI = function(opt_email) { |
| 69 DisplayManager.showSigninUI(opt_email); |
| 70 }; |
| 71 |
| 72 /** |
| 73 * Clears error bubble as well as optional menus that could be open. |
| 74 */ |
| 75 Oobe.clearErrors = function() { |
| 76 DisplayManager.clearErrors(); |
| 77 }; |
| 78 |
| 79 /** |
| 80 * Clears password field in user-pod. |
| 81 */ |
| 82 Oobe.clearUserPodPassword = function() { |
| 83 DisplayManager.clearUserPodPassword(); |
| 84 }; |
| 85 |
| 86 /** |
| 87 * Restores input focus to currently selected pod. |
| 88 */ |
| 89 Oobe.refocusCurrentPod = function() { |
| 90 DisplayManager.refocusCurrentPod(); |
| 91 }; |
| 92 |
| 93 // Export |
| 94 return { |
| 95 Oobe: Oobe |
| 96 }; |
| 97 }); |
| 98 |
| 99 var Oobe = cr.ui.Oobe; |
| 100 |
| 101 // Allow selection events on components with editable text (password field) |
| 102 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
| 103 disableTextSelectAndDrag(function(e) { |
| 104 var src = e.target; |
| 105 return src instanceof HTMLTextAreaElement || |
| 106 src instanceof HTMLInputElement && |
| 107 /text|password|search/.test(src.type); |
| 108 }); |
| 109 |
| 110 document.addEventListener('DOMContentLoaded', function() { |
| 111 'use strict'; |
| 112 }); |
| OLD | NEW |