| 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/screen_account_picker.js"> | 10 <include src="../../../../ui/login/account_picker/screen_account_picker.js"> |
| 10 <include src="../../../../ui/login/account_picker/user_pod_row.js"> | 11 <include src="../../../../ui/login/account_picker/user_pod_row.js"> |
| 11 | 12 |
| 12 | 13 |
| 13 cr.define('cr.ui', function() { | 14 cr.define('cr.ui', function() { |
| 14 var DisplayManager = cr.ui.login.DisplayManager; | 15 var DisplayManager = cr.ui.login.DisplayManager; |
| 15 | 16 |
| 16 /** | 17 /** |
| 18 * Maximum possible height of the #login-header-bar, including the padding |
| 19 * and the border. |
| 20 * @const {number} |
| 21 */ |
| 22 var MAX_LOGIN_HEADER_BAR_HEIGHT = 57; |
| 23 |
| 24 /** |
| 17 * Manages initialization of screens, transitions, and error messages. | 25 * Manages initialization of screens, transitions, and error messages. |
| 18 * @constructor | 26 * @constructor |
| 19 * @extends {DisplayManager} | 27 * @extends {DisplayManager} |
| 20 */ | 28 */ |
| 21 function UserManager() {} | 29 function UserManager() {} |
| 22 | 30 |
| 23 cr.addSingletonGetter(UserManager); | 31 cr.addSingletonGetter(UserManager); |
| 24 | 32 |
| 25 UserManager.prototype = { | 33 UserManager.prototype = { |
| 26 __proto__: DisplayManager.prototype, | 34 __proto__: DisplayManager.prototype, |
| 35 |
| 36 /** |
| 37 * Indicates that this is the Material Design Desktop User Manager. |
| 38 * @type {boolean} |
| 39 */ |
| 40 newDesktopUserManager: true, |
| 41 |
| 42 /** |
| 43 * @override |
| 44 * 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 |
| 46 * placed correctly. Therefore, we use dimensions of the #animated-pages. |
| 47 * @type {{width: number, height: number}} |
| 48 */ |
| 49 get clientAreaSize() { |
| 50 var userManagerPages = document.querySelector('user-manager-pages'); |
| 51 var width = userManagerPages.offsetWidth; |
| 52 // Deduct the maximum possible height of the #login-header-bar from the |
| 53 // height of #animated-pages. Result is the remaining visible height. |
| 54 var height = userManagerPages.offsetHeight - MAX_LOGIN_HEADER_BAR_HEIGHT; |
| 55 return {width: width, height: height}; |
| 56 } |
| 27 }; | 57 }; |
| 28 | 58 |
| 29 /** | 59 /** |
| 30 * Initializes the UserManager. | 60 * Initializes the UserManager. |
| 31 */ | 61 */ |
| 32 UserManager.initialize = function() { | 62 UserManager.initialize = function() { |
| 33 cr.ui.login.DisplayManager.initialize(); | 63 cr.ui.login.DisplayManager.initialize(); |
| 34 login.AccountPickerScreen.register(); | 64 login.AccountPickerScreen.register(); |
| 35 cr.ui.Bubble.decorate($('bubble')); | 65 cr.ui.Bubble.decorate($('bubble')); |
| 36 | 66 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Allow selection events on components with editable text (password field) | 144 // Allow selection events on components with editable text (password field) |
| 115 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 145 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
| 116 disableTextSelectAndDrag(function(e) { | 146 disableTextSelectAndDrag(function(e) { |
| 117 var src = e.target; | 147 var src = e.target; |
| 118 return src instanceof HTMLTextAreaElement || | 148 return src instanceof HTMLTextAreaElement || |
| 119 src instanceof HTMLInputElement && | 149 src instanceof HTMLInputElement && |
| 120 /text|password|search/.test(src.type); | 150 /text|password|search/.test(src.type); |
| 121 }); | 151 }); |
| 122 | 152 |
| 123 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); | 153 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); |
| OLD | NEW |