Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/browser/resources/user_manager/user_manager.js

Issue 385073008: Browser-based guest policy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: User Manager UI hides guest mode Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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="../login/screen.js"></include> 4 <include src="../login/screen.js"></include>
5 <include src="../login/bubble.js"></include> 5 <include src="../login/bubble.js"></include>
6 <include src="../login/display_manager.js"></include> 6 <include src="../login/display_manager.js"></include>
7 <include src="control_bar.js"></include> 7 <include src="control_bar.js"></include>
8 <include src="../login/screen_account_picker.js"></include> 8 <include src="../login/screen_account_picker.js"></include>
9 <include src="../login/user_pod_row.js"></include> 9 <include src="../login/user_pod_row.js"></include>
10 <include src="../login/resource_loader.js"></include> 10 <include src="../login/resource_loader.js"></include>
(...skipping 15 matching lines...) Expand all
26 cr.addSingletonGetter(Oobe); 26 cr.addSingletonGetter(Oobe);
27 27
28 Oobe.prototype = { 28 Oobe.prototype = {
29 __proto__: DisplayManager.prototype, 29 __proto__: DisplayManager.prototype,
30 }; 30 };
31 31
32 /** 32 /**
33 * Shows the given screen. 33 * Shows the given screen.
34 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data} 34 * @param {Object} screen Screen params dict, e.g. {id: screenId, data: data}
35 */ 35 */
36 Oobe.showUserManagerScreen = function() { 36 Oobe.showUserManagerScreen = function(showGuest) {
37 Oobe.getInstance().showScreen({id: 'account-picker', 37 Oobe.getInstance().showScreen({id: 'account-picker',
38 data: {disableAddUser: false}}); 38 data: {disableAddUser: false}});
39 // The ChromeOS account-picker will hide the AddUser button if a user is 39 // The ChromeOS account-picker will hide the AddUser button if a user is
40 // logged in and the screen is "locked", so we must re-enabled it 40 // logged in and the screen is "locked", so we must re-enabled it
41 $('add-user-header-bar-item').hidden = false; 41 $('add-user-header-bar-item').hidden = false;
42 42
43 // Hide the Guest Mode option if the user is not permitted to select it.
44 $('guest-user-button').hidden = !showGuest;
45 $('login-header-bar').hidden = false;
46
43 // Disable the context menu, as the Print/Inspect element items don't 47 // Disable the context menu, as the Print/Inspect element items don't
44 // make sense when displayed as a widget. 48 // make sense when displayed as a widget.
45 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); 49 document.addEventListener('contextmenu', function(e) {e.preventDefault();});
46 50
47 var hash = window.location.hash; 51 var hash = window.location.hash;
48 if (hash && hash == '#tutorial') 52 if (hash && hash == '#tutorial')
49 UserManagerTutorial.startTutorial(); 53 UserManagerTutorial.startTutorial();
50 }; 54 };
51 55
52 /** 56 /**
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 }); 125 });
122 126
123 cr.define('UserManager', function() { 127 cr.define('UserManager', function() {
124 'use strict'; 128 'use strict';
125 129
126 function initialize() { 130 function initialize() {
127 cr.ui.login.DisplayManager.initialize(); 131 cr.ui.login.DisplayManager.initialize();
128 cr.ui.login.UserManagerTutorial.initialize(); 132 cr.ui.login.UserManagerTutorial.initialize();
129 login.AccountPickerScreen.register(); 133 login.AccountPickerScreen.register();
130 cr.ui.Bubble.decorate($('bubble')); 134 cr.ui.Bubble.decorate($('bubble'));
135 // Hide the header bar until the showUserManagerMethod can apply function
Nikita (slow) 2014/07/18 05:37:48 nit: insert empty line before comment.
Mike Lerman 2014/07/18 14:20:59 Done.
136 // parameters that affect widget visiblity.
137 $('login-header-bar').hidden = true;
Nikita (slow) 2014/07/18 05:37:48 I suggest doing this after login.HeaderBar.decorat
Mike Lerman 2014/07/18 14:20:59 Sure does!
131 login.HeaderBar.decorate($('login-header-bar')); 138 login.HeaderBar.decorate($('login-header-bar'));
132 chrome.send('userManagerInitialize'); 139 chrome.send('userManagerInitialize');
133 } 140 }
134 141
135 // Return an object with all of the exports. 142 // Return an object with all of the exports.
136 return { 143 return {
137 initialize: initialize 144 initialize: initialize
138 }; 145 };
139 }); 146 });
140 147
141 var Oobe = cr.ui.Oobe; 148 var Oobe = cr.ui.Oobe;
142 149
143 // Allow selection events on components with editable text (password field) 150 // Allow selection events on components with editable text (password field)
144 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) 151 // bug (http://code.google.com/p/chromium/issues/detail?id=125863)
145 disableTextSelectAndDrag(function(e) { 152 disableTextSelectAndDrag(function(e) {
146 var src = e.target; 153 var src = e.target;
147 return src instanceof HTMLTextAreaElement || 154 return src instanceof HTMLTextAreaElement ||
148 src instanceof HTMLInputElement && 155 src instanceof HTMLInputElement &&
149 /text|password|search/.test(src.type); 156 /text|password|search/.test(src.type);
150 }); 157 });
151 158
152 document.addEventListener('DOMContentLoaded', UserManager.initialize); 159 document.addEventListener('DOMContentLoaded', UserManager.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698