| 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/screen_account_picker.js"> | 9 <include src="../../../../ui/login/account_picker/screen_account_picker.js"> |
| 10 <include src="../../../../ui/login/account_picker/user_pod_row.js"> | 10 <include src="../../../../ui/login/account_picker/user_pod_row.js"> |
| 11 | 11 |
| 12 | 12 |
| 13 cr.define('cr.ui', function() { | 13 cr.define('cr.ui', function() { |
| 14 var DisplayManager = cr.ui.login.DisplayManager; | 14 var DisplayManager = cr.ui.login.DisplayManager; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Maximum possible height of the #login-header-bar, including the padding |
| 18 * and the border. |
| 19 * @const {number} |
| 20 */ |
| 21 var MAX_LOGIN_HEADER_BAR_HEIGHT = 57; |
| 22 |
| 23 /** |
| 17 * Manages initialization of screens, transitions, and error messages. | 24 * Manages initialization of screens, transitions, and error messages. |
| 18 * @constructor | 25 * @constructor |
| 19 * @extends {DisplayManager} | 26 * @extends {DisplayManager} |
| 20 */ | 27 */ |
| 21 function UserManager() {} | 28 function UserManager() {} |
| 22 | 29 |
| 23 cr.addSingletonGetter(UserManager); | 30 cr.addSingletonGetter(UserManager); |
| 24 | 31 |
| 25 UserManager.prototype = { | 32 UserManager.prototype = { |
| 26 __proto__: DisplayManager.prototype, | 33 __proto__: DisplayManager.prototype, |
| 34 |
| 35 /** |
| 36 * @override |
| 37 * Overrides clientAreaSize in DisplayManager. When a new profile is created |
| 38 * the #outer-container page may not be visible yet, so user-pods cannot be |
| 39 * placed correctly. Therefore, we use dimensions of the #animated-pages. |
| 40 * @type {{width: number, height: number}} |
| 41 */ |
| 42 get clientAreaSize() { |
| 43 var animatedPages = $('animatedPages'); |
| 44 var width = animatedPages.offsetWidth; |
| 45 // Deduct the maximum possible height of the #login-header-bar from the |
| 46 // height of #animated-pages. Result is the remaining visible height. |
| 47 var height = animatedPages.offsetHeight - MAX_LOGIN_HEADER_BAR_HEIGHT; |
| 48 return {width: width, height: height}; |
| 49 } |
| 27 }; | 50 }; |
| 28 | 51 |
| 29 /** | 52 /** |
| 30 * Initializes the UserManager. | 53 * Initializes the UserManager. |
| 31 */ | 54 */ |
| 32 UserManager.initialize = function() { | 55 UserManager.initialize = function() { |
| 33 cr.ui.login.DisplayManager.initialize(); | 56 cr.ui.login.DisplayManager.initialize(); |
| 34 login.AccountPickerScreen.register(); | 57 login.AccountPickerScreen.register(); |
| 35 cr.ui.Bubble.decorate($('bubble')); | 58 cr.ui.Bubble.decorate($('bubble')); |
| 36 | 59 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Allow selection events on components with editable text (password field) | 137 // Allow selection events on components with editable text (password field) |
| 115 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 138 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
| 116 disableTextSelectAndDrag(function(e) { | 139 disableTextSelectAndDrag(function(e) { |
| 117 var src = e.target; | 140 var src = e.target; |
| 118 return src instanceof HTMLTextAreaElement || | 141 return src instanceof HTMLTextAreaElement || |
| 119 src instanceof HTMLInputElement && | 142 src instanceof HTMLInputElement && |
| 120 /text|password|search/.test(src.type); | 143 /text|password|search/.test(src.type); |
| 121 }); | 144 }); |
| 122 | 145 |
| 123 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); | 146 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); |
| OLD | NEW |