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