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

Side by Side Diff: chrome/browser/resources/settings/people_page/people_page.js

Issue 2957153003: MD Settings: remove unsupported routes from guest-mode. (Closed)
Patch Set: merge Created 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-people-page' is the settings page containing sign-in settings. 7 * 'settings-people-page' is the settings page containing sign-in settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-people-page', 10 is: 'settings-people-page',
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 }, 86 },
87 readOnly: true, 87 readOnly: true,
88 }, 88 },
89 // </if> 89 // </if>
90 90
91 /** @private {!Map<string, string>} */ 91 /** @private {!Map<string, string>} */
92 focusConfig_: { 92 focusConfig_: {
93 type: Object, 93 type: Object,
94 value: function() { 94 value: function() {
95 var map = new Map(); 95 var map = new Map();
96 map.set(settings.Route.SYNC.path, '#sync-status .subpage-arrow'); 96 if (settings.routes.SYNC)
97 map.set(settings.routes.SYNC.path, '#sync-status .subpage-arrow');
97 // <if expr="not chromeos"> 98 // <if expr="not chromeos">
98 map.set( 99 if (settings.routes.MANAGE_PROFILE) {
99 settings.Route.MANAGE_PROFILE.path, 100 map.set(
100 '#picture-subpage-trigger .subpage-arrow'); 101 settings.routes.MANAGE_PROFILE.path,
102 '#picture-subpage-trigger .subpage-arrow');
103 }
101 // </if> 104 // </if>
102 // <if expr="chromeos"> 105 // <if expr="chromeos">
103 map.set( 106 if (settings.routes.CHANGE_PICTURE) {
104 settings.Route.CHANGE_PICTURE.path, 107 map.set(
105 '#picture-subpage-trigger .subpage-arrow'); 108 settings.routes.CHANGE_PICTURE.path,
106 map.set( 109 '#picture-subpage-trigger .subpage-arrow');
107 settings.Route.LOCK_SCREEN.path, 110 }
108 '#lock-screen-subpage-trigger .subpage-arrow'); 111 if (settings.routes.LOCK_SCREEN) {
109 map.set( 112 map.set(
110 settings.Route.ACCOUNTS.path, 113 settings.routes.LOCK_SCREEN.path,
111 '#manage-other-people-subpage-trigger .subpage-arrow'); 114 '#lock-screen-subpage-trigger .subpage-arrow');
115 }
116 if (settings.routes.ACCOUNTS) {
117 map.set(
118 settings.routes.ACCOUNTS.path,
119 '#manage-other-people-subpage-trigger .subpage-arrow');
120 }
112 // </if> 121 // </if>
113 return map; 122 return map;
114 }, 123 },
115 }, 124 },
116 }, 125 },
117 126
118 /** @private {?settings.SyncBrowserProxy} */ 127 /** @private {?settings.SyncBrowserProxy} */
119 syncBrowserProxy_: null, 128 syncBrowserProxy_: null,
120 129
121 /** @override */ 130 /** @override */
(...skipping 15 matching lines...) Expand all
137 this.syncBrowserProxy_ = settings.SyncBrowserProxyImpl.getInstance(); 146 this.syncBrowserProxy_ = settings.SyncBrowserProxyImpl.getInstance();
138 this.syncBrowserProxy_.getSyncStatus().then( 147 this.syncBrowserProxy_.getSyncStatus().then(
139 this.handleSyncStatus_.bind(this)); 148 this.handleSyncStatus_.bind(this));
140 this.addWebUIListener( 149 this.addWebUIListener(
141 'sync-status-changed', this.handleSyncStatus_.bind(this)); 150 'sync-status-changed', this.handleSyncStatus_.bind(this));
142 }, 151 },
143 152
144 /** @protected */ 153 /** @protected */
145 currentRouteChanged: function() { 154 currentRouteChanged: function() {
146 this.showImportDataDialog_ = 155 this.showImportDataDialog_ =
147 settings.getCurrentRoute() == settings.Route.IMPORT_DATA; 156 settings.getCurrentRoute() == settings.routes.IMPORT_DATA;
148 157
149 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { 158 if (settings.getCurrentRoute() == settings.routes.SIGN_OUT) {
150 // If the sync status has not been fetched yet, optimistically display 159 // If the sync status has not been fetched yet, optimistically display
151 // the disconnect dialog. There is another check when the sync status is 160 // the disconnect dialog. There is another check when the sync status is
152 // fetched. The dialog will be closed then the user is not signed in. 161 // fetched. The dialog will be closed then the user is not signed in.
153 if (this.syncStatus && !this.syncStatus.signedIn) { 162 if (this.syncStatus && !this.syncStatus.signedIn) {
154 settings.navigateToPreviousRoute(); 163 settings.navigateToPreviousRoute();
155 } else { 164 } else {
156 this.showDisconnectDialog_ = true; 165 this.showDisconnectDialog_ = true;
157 this.async(function() { 166 this.async(function() {
158 this.$$('#disconnectDialog').showModal(); 167 this.$$('#disconnectDialog').showModal();
159 }.bind(this)); 168 }.bind(this));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 236
228 if (!syncStatus.signedIn && this.showDisconnectDialog_) 237 if (!syncStatus.signedIn && this.showDisconnectDialog_)
229 this.$$('#disconnectDialog').close(); 238 this.$$('#disconnectDialog').close();
230 239
231 this.syncStatus = syncStatus; 240 this.syncStatus = syncStatus;
232 }, 241 },
233 242
234 /** @private */ 243 /** @private */
235 onPictureTap_: function() { 244 onPictureTap_: function() {
236 // <if expr="chromeos"> 245 // <if expr="chromeos">
237 settings.navigateTo(settings.Route.CHANGE_PICTURE); 246 settings.navigateTo(settings.routes.CHANGE_PICTURE);
238 // </if> 247 // </if>
239 // <if expr="not chromeos"> 248 // <if expr="not chromeos">
240 settings.navigateTo(settings.Route.MANAGE_PROFILE); 249 settings.navigateTo(settings.routes.MANAGE_PROFILE);
241 // </if> 250 // </if>
242 }, 251 },
243 252
244 // <if expr="not chromeos"> 253 // <if expr="not chromeos">
245 /** @private */ 254 /** @private */
246 onProfileNameTap_: function() { 255 onProfileNameTap_: function() {
247 settings.navigateTo(settings.Route.MANAGE_PROFILE); 256 settings.navigateTo(settings.routes.MANAGE_PROFILE);
248 }, 257 },
249 // </if> 258 // </if>
250 259
251 /** @private */ 260 /** @private */
252 onSigninTap_: function() { 261 onSigninTap_: function() {
253 this.syncBrowserProxy_.startSignIn(); 262 this.syncBrowserProxy_.startSignIn();
254 }, 263 },
255 264
256 /** @private */ 265 /** @private */
257 onDisconnectClosed_: function() { 266 onDisconnectClosed_: function() {
258 this.showDisconnectDialog_ = false; 267 this.showDisconnectDialog_ = false;
259 cr.ui.focusWithoutInk(assert(this.$$('#disconnectButton'))); 268 cr.ui.focusWithoutInk(assert(this.$$('#disconnectButton')));
260 269
261 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) 270 if (settings.getCurrentRoute() == settings.routes.SIGN_OUT)
262 settings.navigateToPreviousRoute(); 271 settings.navigateToPreviousRoute();
263 this.fire('signout-dialog-closed'); 272 this.fire('signout-dialog-closed');
264 }, 273 },
265 274
266 /** @private */ 275 /** @private */
267 onDisconnectTap_: function() { 276 onDisconnectTap_: function() {
268 settings.navigateTo(settings.Route.SIGN_OUT); 277 settings.navigateTo(settings.routes.SIGN_OUT);
269 }, 278 },
270 279
271 /** @private */ 280 /** @private */
272 onDisconnectCancel_: function() { 281 onDisconnectCancel_: function() {
273 this.$$('#disconnectDialog').close(); 282 this.$$('#disconnectDialog').close();
274 }, 283 },
275 284
276 /** @private */ 285 /** @private */
277 onDisconnectConfirm_: function() { 286 onDisconnectConfirm_: function() {
278 var deleteProfile = !!this.syncStatus.domain || this.deleteProfile_; 287 var deleteProfile = !!this.syncStatus.domain || this.deleteProfile_;
(...skipping 21 matching lines...) Expand all
300 switch (this.syncStatus.statusAction) { 309 switch (this.syncStatus.statusAction) {
301 case settings.StatusAction.REAUTHENTICATE: 310 case settings.StatusAction.REAUTHENTICATE:
302 this.syncBrowserProxy_.startSignIn(); 311 this.syncBrowserProxy_.startSignIn();
303 break; 312 break;
304 case settings.StatusAction.SIGNOUT_AND_SIGNIN: 313 case settings.StatusAction.SIGNOUT_AND_SIGNIN:
305 // <if expr="chromeos"> 314 // <if expr="chromeos">
306 this.syncBrowserProxy_.attemptUserExit(); 315 this.syncBrowserProxy_.attemptUserExit();
307 // </if> 316 // </if>
308 // <if expr="not chromeos"> 317 // <if expr="not chromeos">
309 if (this.syncStatus.domain) 318 if (this.syncStatus.domain)
310 settings.navigateTo(settings.Route.SIGN_OUT); 319 settings.navigateTo(settings.routes.SIGN_OUT);
311 else { 320 else {
312 // Silently sign the user out without deleting their profile and 321 // Silently sign the user out without deleting their profile and
313 // prompt them to sign back in. 322 // prompt them to sign back in.
314 this.syncBrowserProxy_.signOut(false); 323 this.syncBrowserProxy_.signOut(false);
315 this.syncBrowserProxy_.startSignIn(); 324 this.syncBrowserProxy_.startSignIn();
316 } 325 }
317 // </if> 326 // </if>
318 break; 327 break;
319 case settings.StatusAction.UPGRADE_CLIENT: 328 case settings.StatusAction.UPGRADE_CLIENT:
320 settings.navigateTo(settings.Route.ABOUT); 329 settings.navigateTo(settings.routes.ABOUT);
321 break; 330 break;
322 case settings.StatusAction.ENTER_PASSPHRASE: 331 case settings.StatusAction.ENTER_PASSPHRASE:
323 case settings.StatusAction.CONFIRM_SYNC_SETTINGS: 332 case settings.StatusAction.CONFIRM_SYNC_SETTINGS:
324 case settings.StatusAction.NO_ACTION: 333 case settings.StatusAction.NO_ACTION:
325 default: 334 default:
326 settings.navigateTo(settings.Route.SYNC); 335 settings.navigateTo(settings.routes.SYNC);
327 } 336 }
328 }, 337 },
329 338
330 // <if expr="chromeos"> 339 // <if expr="chromeos">
331 /** 340 /**
332 * @param {!Event} e 341 * @param {!Event} e
333 * @private 342 * @private
334 */ 343 */
335 onConfigureLockTap_: function(e) { 344 onConfigureLockTap_: function(e) {
336 // Navigating to the lock screen will always open the password prompt 345 // Navigating to the lock screen will always open the password prompt
337 // dialog, so prevent the end of the tap event to focus what is underneath 346 // dialog, so prevent the end of the tap event to focus what is underneath
338 // it, which takes focus from the dialog. 347 // it, which takes focus from the dialog.
339 e.preventDefault(); 348 e.preventDefault();
340 settings.navigateTo(settings.Route.LOCK_SCREEN); 349 settings.navigateTo(settings.routes.LOCK_SCREEN);
341 }, 350 },
342 // </if> 351 // </if>
343 352
344 /** @private */ 353 /** @private */
345 onManageOtherPeople_: function() { 354 onManageOtherPeople_: function() {
346 // <if expr="not chromeos"> 355 // <if expr="not chromeos">
347 this.syncBrowserProxy_.manageOtherPeople(); 356 this.syncBrowserProxy_.manageOtherPeople();
348 // </if> 357 // </if>
349 // <if expr="chromeos"> 358 // <if expr="chromeos">
350 settings.navigateTo(settings.Route.ACCOUNTS); 359 settings.navigateTo(settings.routes.ACCOUNTS);
351 // </if> 360 // </if>
352 }, 361 },
353 362
354 // <if expr="not chromeos"> 363 // <if expr="not chromeos">
355 /** 364 /**
356 * @private 365 * @private
357 * @param {string} domain 366 * @param {string} domain
358 * @return {string} 367 * @return {string}
359 */ 368 */
360 getDomainHtml_: function(domain) { 369 getDomainHtml_: function(domain) {
361 var innerSpan = '<span id="managed-by-domain-name">' + domain + '</span>'; 370 var innerSpan = '<span id="managed-by-domain-name">' + domain + '</span>';
362 return loadTimeData.getStringF('domainManagedProfile', innerSpan); 371 return loadTimeData.getStringF('domainManagedProfile', innerSpan);
363 }, 372 },
364 373
365 /** @private */ 374 /** @private */
366 onImportDataTap_: function() { 375 onImportDataTap_: function() {
367 settings.navigateTo(settings.Route.IMPORT_DATA); 376 settings.navigateTo(settings.routes.IMPORT_DATA);
368 }, 377 },
369 378
370 /** @private */ 379 /** @private */
371 onImportDataDialogClosed_: function() { 380 onImportDataDialogClosed_: function() {
372 settings.navigateToPreviousRoute(); 381 settings.navigateToPreviousRoute();
373 cr.ui.focusWithoutInk(assert(this.$.importDataDialogTrigger)); 382 cr.ui.focusWithoutInk(assert(this.$.importDataDialogTrigger));
374 }, 383 },
375 // </if> 384 // </if>
376 385
377 /** 386 /**
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 463
455 /** 464 /**
456 * @param {!settings.SyncStatus} syncStatus 465 * @param {!settings.SyncStatus} syncStatus
457 * @return {boolean} Whether to show the "Sign in to Chrome" button. 466 * @return {boolean} Whether to show the "Sign in to Chrome" button.
458 * @private 467 * @private
459 */ 468 */
460 showSignin_: function(syncStatus) { 469 showSignin_: function(syncStatus) {
461 return !!syncStatus.signinAllowed && !syncStatus.signedIn; 470 return !!syncStatus.signinAllowed && !syncStatus.signedIn;
462 }, 471 },
463 }); 472 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698