OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 <include src="../../../../ui/login/screen.js"> | 4 <include src="../../../../ui/login/screen.js"> |
5 <include src="../../../../ui/login/bubble.js"> | 5 <include src="../../../../ui/login/bubble.js"> |
6 <include src="../../../../ui/login/login_ui_tools.js"> | 6 <include src="../../../../ui/login/login_ui_tools.js"> |
7 <include src="../../../../ui/login/display_manager.js"> | 7 <include src="../../../../ui/login/display_manager.js"> |
8 <include src="control_bar.js"> | 8 <include src="control_bar.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"> |
(...skipping 16 matching lines...) Expand all Loading... |
27 cr.addSingletonGetter(Oobe); | 27 cr.addSingletonGetter(Oobe); |
28 | 28 |
29 Oobe.prototype = { | 29 Oobe.prototype = { |
30 __proto__: DisplayManager.prototype, | 30 __proto__: DisplayManager.prototype, |
31 }; | 31 }; |
32 | 32 |
33 /** | 33 /** |
34 * Shows the given screen. | 34 * Shows the given screen. |
35 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data} | 35 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data} |
36 */ | 36 */ |
37 Oobe.showUserManagerScreen = function() { | 37 Oobe.showUserManagerScreen = function(showGuest) { |
38 Oobe.getInstance().showScreen({id: 'account-picker', | 38 Oobe.getInstance().showScreen({id: 'account-picker', |
39 data: {disableAddUser: false}}); | 39 data: {disableAddUser: false}}); |
40 // The ChromeOS account-picker will hide the AddUser button if a user is | 40 // The ChromeOS account-picker will hide the AddUser button if a user is |
41 // logged in and the screen is "locked", so we must re-enabled it | 41 // logged in and the screen is "locked", so we must re-enabled it |
42 $('add-user-header-bar-item').hidden = false; | 42 $('add-user-header-bar-item').hidden = false; |
43 | 43 |
| 44 // Hide the Guest Mode option if the user is not permitted to select it. |
| 45 $('guest-user-button').hidden = !showGuest; |
| 46 $('login-header-bar').hidden = false; |
| 47 |
44 // Disable the context menu, as the Print/Inspect element items don't | 48 // Disable the context menu, as the Print/Inspect element items don't |
45 // make sense when displayed as a widget. | 49 // make sense when displayed as a widget. |
46 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); | 50 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); |
47 | 51 |
48 var hash = window.location.hash; | 52 var hash = window.location.hash; |
49 if (hash && hash == '#tutorial') | 53 if (hash && hash == '#tutorial') |
50 UserManagerTutorial.startTutorial(); | 54 UserManagerTutorial.startTutorial(); |
51 }; | 55 }; |
52 | 56 |
53 /** | 57 /** |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 127 |
124 cr.define('UserManager', function() { | 128 cr.define('UserManager', function() { |
125 'use strict'; | 129 'use strict'; |
126 | 130 |
127 function initialize() { | 131 function initialize() { |
128 cr.ui.login.DisplayManager.initialize(); | 132 cr.ui.login.DisplayManager.initialize(); |
129 cr.ui.login.UserManagerTutorial.initialize(); | 133 cr.ui.login.UserManagerTutorial.initialize(); |
130 login.AccountPickerScreen.register(); | 134 login.AccountPickerScreen.register(); |
131 cr.ui.Bubble.decorate($('bubble')); | 135 cr.ui.Bubble.decorate($('bubble')); |
132 login.HeaderBar.decorate($('login-header-bar')); | 136 login.HeaderBar.decorate($('login-header-bar')); |
| 137 |
| 138 // Hide the header bar until the showUserManagerMethod can apply function |
| 139 // parameters that affect widget visiblity. |
| 140 $('login-header-bar').hidden = true; |
133 chrome.send('userManagerInitialize'); | 141 chrome.send('userManagerInitialize'); |
134 } | 142 } |
135 | 143 |
136 // Return an object with all of the exports. | 144 // Return an object with all of the exports. |
137 return { | 145 return { |
138 initialize: initialize | 146 initialize: initialize |
139 }; | 147 }; |
140 }); | 148 }); |
141 | 149 |
142 var Oobe = cr.ui.Oobe; | 150 var Oobe = cr.ui.Oobe; |
143 | 151 |
144 // Allow selection events on components with editable text (password field) | 152 // Allow selection events on components with editable text (password field) |
145 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 153 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
146 disableTextSelectAndDrag(function(e) { | 154 disableTextSelectAndDrag(function(e) { |
147 var src = e.target; | 155 var src = e.target; |
148 return src instanceof HTMLTextAreaElement || | 156 return src instanceof HTMLTextAreaElement || |
149 src instanceof HTMLInputElement && | 157 src instanceof HTMLInputElement && |
150 /text|password|search/.test(src.type); | 158 /text|password|search/.test(src.type); |
151 }); | 159 }); |
152 | 160 |
153 document.addEventListener('DOMContentLoaded', UserManager.initialize); | 161 document.addEventListener('DOMContentLoaded', UserManager.initialize); |
OLD | NEW |