OLD | NEW |
---|---|
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 this.syncBrowserProxy_.signOut(deleteProfile); | 250 this.syncBrowserProxy_.signOut(deleteProfile); |
251 | 251 |
252 this.$.disconnectDialog.close(); | 252 this.$.disconnectDialog.close(); |
253 }, | 253 }, |
254 | 254 |
255 /** @private */ | 255 /** @private */ |
256 onSyncTap_: function() { | 256 onSyncTap_: function() { |
257 assert(this.syncStatus.signedIn); | 257 assert(this.syncStatus.signedIn); |
258 assert(this.syncStatus.syncSystemEnabled); | 258 assert(this.syncStatus.syncSystemEnabled); |
259 | 259 |
260 if (this.syncStatus.managed) | 260 if (!this.isSyncStatusActionable_(this.syncStatus)) |
261 return; | 261 return; |
262 | 262 |
263 settings.navigateTo(settings.Route.SYNC); | 263 switch (this.syncStatus.statusAction) { |
264 case settings.StatusAction.REAUTHENTICATE: | |
265 <if expr="chromeos"> | |
266 this.syncBrowserProxy_.attemptUserExit(); | |
267 </if> | |
268 <if expr="not chromeos"> | |
269 if (this.syncStatus.domain) | |
270 settings.navigateTo(settings.Route.SIGN_OUT); | |
271 else { | |
272 // Silently sign the user out without deleting their profile and | |
273 // prompt them to sign back in. | |
274 this.syncBrowserProxy_.signOut(false); | |
275 this.syncBrowserProxy_.startSignIn(); | |
276 } | |
277 </if> | |
278 break; | |
279 case settings.StatusAction.UPGRADE_CLIENT: | |
280 settings.navigateTo(settings.Route.ABOUT); | |
281 break; | |
282 case settings.StatusAction.ENTER_PASSPHRASE: | |
283 case settings.StatusAction.NO_ACTION: | |
284 default: | |
285 settings.navigateTo(settings.Route.SYNC); | |
286 } | |
tommycli
2016/10/28 21:21:09
I assume all these behaviors are desired / specifi
Moe
2016/11/01 19:44:01
I believe so. I need to double check the 'upgrade'
| |
264 }, | 287 }, |
265 | 288 |
266 <if expr="chromeos"> | 289 <if expr="chromeos"> |
267 /** @private */ | 290 /** @private */ |
268 onConfigureLockTap_: function() { | 291 onConfigureLockTap_: function() { |
269 settings.navigateTo(settings.Route.LOCK_SCREEN); | 292 settings.navigateTo(settings.Route.LOCK_SCREEN); |
270 }, | 293 }, |
271 | 294 |
272 /** @private */ | 295 /** @private */ |
273 onEasyUnlockSetupTap_: function() { | 296 onEasyUnlockSetupTap_: function() { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 * @return {boolean} | 353 * @return {boolean} |
331 */ | 354 */ |
332 isAdvancedSyncSettingsVisible_: function(syncStatus) { | 355 isAdvancedSyncSettingsVisible_: function(syncStatus) { |
333 return !!syncStatus && !!syncStatus.signedIn && | 356 return !!syncStatus && !!syncStatus.signedIn && |
334 !!syncStatus.syncSystemEnabled; | 357 !!syncStatus.syncSystemEnabled; |
335 }, | 358 }, |
336 | 359 |
337 /** | 360 /** |
338 * @private | 361 * @private |
339 * @param {?settings.SyncStatus} syncStatus | 362 * @param {?settings.SyncStatus} syncStatus |
363 * @return {boolean} Whether an action can be taken with the sync status. sync | |
364 * status is actionable if sync is not managed and if there is a sync | |
365 * error, there is an action associated with it. | |
366 */ | |
367 isSyncStatusActionable_: function(syncStatus) { | |
368 return !!syncStatus && !syncStatus.managed && (!syncStatus.hasError || | |
369 syncStatus.statusAction != settings.StatusAction.NO_ACTION); | |
370 }, | |
371 | |
372 /** | |
373 * @private | |
374 * @param {?settings.SyncStatus} syncStatus | |
340 * @return {string} | 375 * @return {string} |
341 */ | 376 */ |
342 getSyncIcon_: function(syncStatus) { | 377 getSyncIcon_: function(syncStatus) { |
343 if (!syncStatus) | 378 if (!syncStatus) |
344 return ''; | 379 return ''; |
380 | |
381 var syncIcon = 'settings:sync'; | |
382 | |
345 if (syncStatus.hasError) | 383 if (syncStatus.hasError) |
346 return 'settings:sync-problem'; | 384 syncIcon = 'settings:sync-problem'; |
385 | |
386 // Override the icon to the disabled icon if sync is managed. | |
347 if (syncStatus.managed) | 387 if (syncStatus.managed) |
348 return 'settings:sync-disabled'; | 388 syncIcon = 'settings:sync-disabled'; |
349 | 389 |
350 return 'settings:sync'; | 390 return syncIcon; |
351 }, | 391 }, |
352 | 392 |
353 /** | 393 /** |
394 * @private | |
395 * @param {?settings.SyncStatus} syncStatus | |
396 * @return {string} The class name for the sync status text. | |
397 */ | |
398 getSyncStatusTextClass_: function(syncStatus) { | |
399 return (!!syncStatus && syncStatus.hasError) ? 'sync-error' : ''; | |
400 }, | |
401 | |
402 /** | |
354 * @param {string} iconUrl | 403 * @param {string} iconUrl |
355 * @return {string} A CSS imageset for multiple scale factors. | 404 * @return {string} A CSS imageset for multiple scale factors. |
356 * @private | 405 * @private |
357 */ | 406 */ |
358 getIconImageset_: function(iconUrl) { | 407 getIconImageset_: function(iconUrl) { |
359 return cr.icon.getImage(iconUrl); | 408 return cr.icon.getImage(iconUrl); |
360 }, | 409 }, |
361 | 410 |
362 /** | 411 /** |
363 * @return {boolean} Whether to show the "Sign in to Chrome" button. | 412 * @return {boolean} Whether to show the "Sign in to Chrome" button. |
364 * @private | 413 * @private |
365 */ | 414 */ |
366 showSignin_: function(syncStatus) { | 415 showSignin_: function(syncStatus) { |
367 return !!syncStatus.signinAllowed && !syncStatus.signedIn; | 416 return !!syncStatus.signinAllowed && !syncStatus.signedIn; |
368 }, | 417 }, |
369 }); | 418 }); |
OLD | NEW |