| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 <include src="../../../../ui/login/screen.js"> | 5 <include src="../../../../ui/login/screen.js"> |
| 6 <include src="../../../../ui/login/bubble.js"> | 6 <include src="../../../../ui/login/bubble.js"> |
| 7 <include src="../../../../ui/login/login_ui_tools.js"> | 7 <include src="../../../../ui/login/login_ui_tools.js"> |
| 8 <include src="../../../../ui/login/display_manager.js"> | 8 <include src="../../../../ui/login/display_manager.js"> |
| 9 <include src="../../../../ui/login/account_picker/user_pod_template.js"> | 9 <include src="../../../../ui/login/account_picker/user_pod_template.js"> |
| 10 <include src="../../../../ui/login/account_picker/screen_account_picker.js"> | 10 <include src="../../../../ui/login/account_picker/screen_account_picker.js"> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 UserManager.prototype = { | 33 UserManager.prototype = { |
| 34 __proto__: DisplayManager.prototype, | 34 __proto__: DisplayManager.prototype, |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Indicates that this is the Material Design Desktop User Manager. | 37 * Indicates that this is the Material Design Desktop User Manager. |
| 38 * @type {boolean} | 38 * @type {boolean} |
| 39 */ | 39 */ |
| 40 newDesktopUserManager: true, | 40 newDesktopUserManager: true, |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * True if all (non-supervised and non-child) profiles are locked. |
| 44 * @type {boolean} |
| 45 */ |
| 46 areAllProfilesLocked: false, |
| 47 |
| 48 /** |
| 43 * @override | 49 * @override |
| 44 * Overrides clientAreaSize in DisplayManager. When a new profile is created | 50 * Overrides clientAreaSize in DisplayManager. When a new profile is created |
| 45 * the #outer-container page may not be visible yet, so user-pods cannot be | 51 * the #outer-container page may not be visible yet, so user-pods cannot be |
| 46 * placed correctly. Therefore, we use dimensions of the #animated-pages. | 52 * placed correctly. Therefore, we use dimensions of the #animated-pages. |
| 47 * @type {{width: number, height: number}} | 53 * @type {{width: number, height: number}} |
| 48 */ | 54 */ |
| 49 get clientAreaSize() { | 55 get clientAreaSize() { |
| 50 var userManagerPages = document.querySelector('user-manager-pages'); | 56 var userManagerPages = document.querySelector('user-manager-pages'); |
| 51 var width = userManagerPages.offsetWidth; | 57 var width = userManagerPages.offsetWidth; |
| 52 // Deduct the maximum possible height of the #login-header-bar from the | 58 // Deduct the maximum possible height of the #login-header-bar from the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 signin.ProfileBrowserProxyImpl.getInstance().initializeUserManager( | 73 signin.ProfileBrowserProxyImpl.getInstance().initializeUserManager( |
| 68 window.location.hash); | 74 window.location.hash); |
| 69 }; | 75 }; |
| 70 | 76 |
| 71 /** | 77 /** |
| 72 * Shows the given screen. | 78 * Shows the given screen. |
| 73 * @param {boolean} showGuest True if 'Browse as Guest' button should be | 79 * @param {boolean} showGuest True if 'Browse as Guest' button should be |
| 74 * displayed. | 80 * displayed. |
| 75 * @param {boolean} showAddPerson True if 'Add Person' button should be | 81 * @param {boolean} showAddPerson True if 'Add Person' button should be |
| 76 * displayed. | 82 * displayed. |
| 83 * @param {boolean} areAllProfilesLocked True if all profiles are locked. |
| 77 */ | 84 */ |
| 78 UserManager.showUserManagerScreen = function(showGuest, showAddPerson) { | 85 UserManager.showUserManagerScreen = function(showGuest, |
| 86 showAddPerson, |
| 87 areAllProfilesLocked) { |
| 88 UserManager.getInstance().areAllProfilesLocked = areAllProfilesLocked; |
| 89 |
| 79 UserManager.getInstance().showScreen({id: 'account-picker', | 90 UserManager.getInstance().showScreen({id: 'account-picker', |
| 80 data: {disableAddUser: false}}); | 91 data: {disableAddUser: false}}); |
| 81 // Hide control options if the user does not have the right permissions. | 92 // Hide control options if the user does not have the right permissions. |
| 82 var controlBar = document.querySelector('control-bar'); | 93 var controlBar = document.querySelector('control-bar'); |
| 83 controlBar.showGuest = showGuest; | 94 controlBar.showGuest = showGuest; |
| 84 controlBar.showAddPerson = showAddPerson; | 95 controlBar.showAddPerson = showAddPerson; |
| 85 | 96 |
| 86 // Disable the context menu, as the Print/Inspect element items don't | 97 // Disable the context menu, as the Print/Inspect element items don't |
| 87 // make sense when displayed as a widget. | 98 // make sense when displayed as a widget. |
| 88 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); | 99 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 DisplayManager.showSignInError(loginAttempts, message, link, helpId); | 136 DisplayManager.showSignInError(loginAttempts, message, link, helpId); |
| 126 }; | 137 }; |
| 127 | 138 |
| 128 /** | 139 /** |
| 129 * Clears error bubble as well as optional menus that could be open. | 140 * Clears error bubble as well as optional menus that could be open. |
| 130 */ | 141 */ |
| 131 UserManager.clearErrors = function() { | 142 UserManager.clearErrors = function() { |
| 132 DisplayManager.clearErrors(); | 143 DisplayManager.clearErrors(); |
| 133 }; | 144 }; |
| 134 | 145 |
| 146 /** |
| 147 * Shows the error dialog populated with the given message. |
| 148 * @param {string} message Error message to show. |
| 149 */ |
| 150 UserManager.showErrorDialog = function(message) { |
| 151 document.querySelector('error-dialog').show(message); |
| 152 }; |
| 153 |
| 135 // Export | 154 // Export |
| 136 return { | 155 return { |
| 137 UserManager: UserManager | 156 UserManager: UserManager |
| 138 }; | 157 }; |
| 139 }); | 158 }); |
| 140 | 159 |
| 141 // Alias to Oobe for use in src/ui/login/account_picker/user_pod_row.js | 160 // Alias to Oobe for use in src/ui/login/account_picker/user_pod_row.js |
| 142 var Oobe = cr.ui.UserManager; | 161 var Oobe = cr.ui.UserManager; |
| 143 | 162 |
| 144 // Allow selection events on components with editable text (password field) | 163 // Allow selection events on components with editable text (password field) |
| 145 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 164 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
| 146 disableTextSelectAndDrag(function(e) { | 165 disableTextSelectAndDrag(function(e) { |
| 147 var src = e.target; | 166 var src = e.target; |
| 148 return src instanceof HTMLTextAreaElement || | 167 return src instanceof HTMLTextAreaElement || |
| 149 src instanceof HTMLInputElement && | 168 src instanceof HTMLInputElement && |
| 150 /text|password|search/.test(src.type); | 169 /text|password|search/.test(src.type); |
| 151 }); | 170 }); |
| 152 | 171 |
| 153 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); | 172 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); |
| OLD | NEW |