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 | 17 * Maximum possible height of the #login-header-bar, including the padding |
18 * and the border. | 18 * and the border. |
19 * @const {number} | 19 * @const {number} |
20 */ | 20 */ |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 }; | 88 }; |
89 | 89 |
90 /** | 90 /** |
91 * Shows the given screen. | 91 * Shows the given screen. |
92 * @param {boolean} showGuest True if 'Browse as Guest' button should be | 92 * @param {boolean} showGuest True if 'Browse as Guest' button should be |
93 * displayed. | 93 * displayed. |
94 * @param {boolean} showAddPerson True if 'Add Person' button should be | 94 * @param {boolean} showAddPerson True if 'Add Person' button should be |
95 * displayed. | 95 * displayed. |
96 */ | 96 */ |
97 UserManager.showUserManagerScreen = function(showGuest, showAddPerson) { | 97 UserManager.showUserManagerScreen = function(showGuest, showAddPerson) { |
98 UserManager.getInstance().showScreen({id: 'account-picker', | 98 UserManager.getInstance().showScreen( |
99 data: {disableAddUser: false}}); | 99 {id: 'account-picker', data: {disableAddUser: false}}); |
100 // Hide control options if the user does not have the right permissions. | 100 // Hide control options if the user does not have the right permissions. |
101 var controlBar = document.querySelector('control-bar'); | 101 var controlBar = document.querySelector('control-bar'); |
102 controlBar.showGuest = showGuest; | 102 controlBar.showGuest = showGuest; |
103 controlBar.showAddPerson = showAddPerson; | 103 controlBar.showAddPerson = showAddPerson; |
104 | 104 |
105 // Disable the context menu, as the Print/Inspect element items don't | 105 // Disable the context menu, as the Print/Inspect element items don't |
106 // make sense when displayed as a widget. | 106 // make sense when displayed as a widget. |
107 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); | 107 document.addEventListener('contextmenu', function(e) { |
| 108 e.preventDefault(); |
| 109 }); |
108 | 110 |
109 if (window.location.hash == '#tutorial') | 111 if (window.location.hash == '#tutorial') |
110 document.querySelector('user-manager-tutorial').startTutorial(); | 112 document.querySelector('user-manager-tutorial').startTutorial(); |
111 else if (window.location.hash == '#create-user') { | 113 else if (window.location.hash == '#create-user') { |
112 document.querySelector('user-manager-pages').setSelectedPage( | 114 document.querySelector('user-manager-pages') |
113 'create-user-page'); | 115 .setSelectedPage('create-user-page'); |
114 } | 116 } |
115 }; | 117 }; |
116 | 118 |
117 /** | 119 /** |
118 * Open a new browser for the given profile. | 120 * Open a new browser for the given profile. |
119 * @param {string} profilePath The profile's path. | 121 * @param {string} profilePath The profile's path. |
120 */ | 122 */ |
121 UserManager.launchUser = function(profilePath) { | 123 UserManager.launchUser = function(profilePath) { |
122 signin.ProfileBrowserProxyImpl.getInstance().launchUser(profilePath); | 124 signin.ProfileBrowserProxyImpl.getInstance().launchUser(profilePath); |
123 }; | 125 }; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 159 |
158 /** | 160 /** |
159 * Shows the error dialog populated with the given message. | 161 * Shows the error dialog populated with the given message. |
160 * @param {string} message Error message to show. | 162 * @param {string} message Error message to show. |
161 */ | 163 */ |
162 UserManager.showErrorDialog = function(message) { | 164 UserManager.showErrorDialog = function(message) { |
163 document.querySelector('error-dialog').show(message); | 165 document.querySelector('error-dialog').show(message); |
164 }; | 166 }; |
165 | 167 |
166 // Export | 168 // Export |
167 return { | 169 return {UserManager: UserManager}; |
168 UserManager: UserManager | |
169 }; | |
170 }); | 170 }); |
171 | 171 |
172 // Alias to Oobe for use in src/ui/login/account_picker/user_pod_row.js | 172 // Alias to Oobe for use in src/ui/login/account_picker/user_pod_row.js |
173 var Oobe = cr.ui.UserManager; | 173 var Oobe = cr.ui.UserManager; |
174 | 174 |
175 // Allow selection events on components with editable text (password field) | 175 // Allow selection events on components with editable text (password field) |
176 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 176 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
177 disableTextSelectAndDrag(function(e) { | 177 disableTextSelectAndDrag(function(e) { |
178 var src = e.target; | 178 var src = e.target; |
179 return src instanceof HTMLTextAreaElement || | 179 return src instanceof HTMLTextAreaElement || |
180 src instanceof HTMLInputElement && | 180 src instanceof HTMLInputElement && /text|password|search/.test(src.type); |
181 /text|password|search/.test(src.type); | |
182 }); | 181 }); |
183 | 182 |
184 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); | 183 document.addEventListener('DOMContentLoaded', cr.ui.UserManager.initialize); |
185 | 184 |
186 document.addEventListener('change-page', cr.ui.UserManager.onPageChanged_); | 185 document.addEventListener('change-page', cr.ui.UserManager.onPageChanged_); |
OLD | NEW |