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

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

Issue 1630903002: material design user manager with create profile flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed the comments Created 4 years, 10 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 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 */
5
4 <include src="../../../../ui/login/screen.js"> 6 <include src="../../../../ui/login/screen.js">
5 <include src="../../../../ui/login/bubble.js"> 7 <include src="../../../../ui/login/bubble.js">
6 <include src="../../../../ui/login/login_ui_tools.js"> 8 <include src="../../../../ui/login/login_ui_tools.js">
7 <include src="../../../../ui/login/display_manager.js"> 9 <include src="../../../../ui/login/display_manager.js">
8 <include src="control_bar.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 <include src="../../../../ui/login/resource_loader.js"> 12 <include src="../../../../ui/login/resource_loader.js">
12 <include src="user_manager_tutorial.js"> 13
13 14
14 cr.define('cr.ui', function() { 15 cr.define('cr.ui', function() {
15 var DisplayManager = cr.ui.login.DisplayManager; 16 var DisplayManager = cr.ui.login.DisplayManager;
16 var UserManagerTutorial = cr.ui.login.UserManagerTutorial;
17 17
18 /** 18 /**
19 * Constructs an Out of box controller. It manages initialization of screens, 19 * Constructs an Out of box controller. It manages initialization of screens,
20 * transitions, error messages display. 20 * transitions, error messages display.
21 * @extends {DisplayManager} 21 * @extends {DisplayManager}
22 * @constructor 22 * @constructor
23 */ 23 */
24 function Oobe() { 24 function Oobe() {
25 } 25 }
26 26
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 {bool} showGuest Whether the 'Browse as Guest' button is displayed. 35 * @param {bool} showGuest Whether the 'Browse as Guest' button is displayed.
36 * @param {bool} showAddPerson Whether the 'Add Person' button is displayed. 36 * @param {bool} showAddPerson Whether the 'Add Person' button is displayed.
37 */ 37 */
38 Oobe.showUserManagerScreen = function(showGuest, showAddPerson) { 38 Oobe.showUserManagerScreen = function(showGuest, showAddPerson) {
39 Oobe.getInstance().showScreen({id: 'account-picker', 39 Oobe.getInstance().showScreen({id: 'account-picker',
40 data: {disableAddUser: false}}); 40 data: {disableAddUser: false}});
41 // The ChromeOS account-picker will hide the AddUser button if a user is
42 // logged in and the screen is "locked", so we must re-enabled it
43 $('add-user-header-bar-item').hidden = false;
44
45 // Hide control options if the user does not have the right permissions. 41 // Hide control options if the user does not have the right permissions.
46 $('guest-user-button').hidden = !showGuest; 42 document.querySelector('control-bar').showGuest = showGuest;
47 $('add-user-button').hidden = !showAddPerson; 43 document.querySelector('control-bar').showAddPerson = showAddPerson;
48 $('login-header-bar').hidden = false;
49 44
50 // Disable the context menu, as the Print/Inspect element items don't 45 // Disable the context menu, as the Print/Inspect element items don't
51 // make sense when displayed as a widget. 46 // make sense when displayed as a widget.
52 document.addEventListener('contextmenu', function(e) {e.preventDefault();}); 47 document.addEventListener('contextmenu', function(e) {e.preventDefault();});
53 48
54 var hash = window.location.hash; 49 var hash = window.location.hash;
55 if (hash && hash == '#tutorial') 50 if (hash && hash == '#tutorial')
56 UserManagerTutorial.startTutorial(); 51 document.querySelector('user-manager-tutorial').startTutorial();
57 }; 52 };
58 53
59 /** 54 /**
60 * Open a new browser for the given profile. 55 * Open a new browser for the given profile.
61 * @param {string} profilePath The profile's path. 56 * @param {string} profilePath The profile's path.
62 */ 57 */
63 Oobe.launchUser = function(profilePath) { 58 Oobe.launchUser = function(profilePath) {
64 chrome.send('launchUser', [profilePath]); 59 chrome.send('launchUser', [profilePath]);
65 }; 60 };
66 61
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 101
107 /** 102 /**
108 * Restores input focus to currently selected pod. 103 * Restores input focus to currently selected pod.
109 */ 104 */
110 Oobe.refocusCurrentPod = function() { 105 Oobe.refocusCurrentPod = function() {
111 DisplayManager.refocusCurrentPod(); 106 DisplayManager.refocusCurrentPod();
112 }; 107 };
113 108
114 /** 109 /**
115 * Show the user manager tutorial 110 * Show the user manager tutorial
116 * @param {string} email The user's email, if signed in.
117 * @param {string} displayName The user's display name.
118 */ 111 */
119 Oobe.showUserManagerTutorial = function() { 112 Oobe.showUserManagerTutorial = function() {
120 UserManagerTutorial.startTutorial(); 113 document.querySelector('user-manager-tutorial').startTutorial();
121 }; 114 };
122 115
123 // Export 116 // Export
124 return { 117 return {
125 Oobe: Oobe 118 Oobe: Oobe
126 }; 119 };
127 }); 120 });
128 121
129 cr.define('UserManager', function() { 122 cr.define('UserManager', function() {
130 'use strict'; 123 'use strict';
131 124
132 function initialize() { 125 function initialize() {
133 cr.ui.login.DisplayManager.initialize(); 126 cr.ui.login.DisplayManager.initialize();
134 cr.ui.login.UserManagerTutorial.initialize();
135 login.AccountPickerScreen.register(); 127 login.AccountPickerScreen.register();
136 cr.ui.Bubble.decorate($('bubble')); 128 cr.ui.Bubble.decorate($('bubble'));
137 login.HeaderBar.decorate($('login-header-bar'));
138
139 // Hide the header bar until the showUserManagerMethod can apply function
140 // parameters that affect widget visiblity.
141 $('login-header-bar').hidden = true;
142 129
143 chrome.send('userManagerInitialize', [window.location.hash]); 130 chrome.send('userManagerInitialize', [window.location.hash]);
144 } 131 }
145 132
146 // Return an object with all of the exports. 133 // Return an object with all of the exports.
147 return { 134 return {
148 initialize: initialize 135 initialize: initialize
149 }; 136 };
150 }); 137 });
151 138
152 var Oobe = cr.ui.Oobe; 139 var Oobe = cr.ui.Oobe;
153 140
154 // Allow selection events on components with editable text (password field) 141 // Allow selection events on components with editable text (password field)
155 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) 142 // bug (http://code.google.com/p/chromium/issues/detail?id=125863)
156 disableTextSelectAndDrag(function(e) { 143 disableTextSelectAndDrag(function(e) {
157 var src = e.target; 144 var src = e.target;
158 return src instanceof HTMLTextAreaElement || 145 return src instanceof HTMLTextAreaElement ||
159 src instanceof HTMLInputElement && 146 src instanceof HTMLInputElement &&
160 /text|password|search/.test(src.type); 147 /text|password|search/.test(src.type);
161 }); 148 });
162 149
163 document.addEventListener('DOMContentLoaded', UserManager.initialize); 150 document.addEventListener('DOMContentLoaded', UserManager.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698