| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * 'settings-signin-page' is the settings page containing sign-in settings. | |
| 8 * | |
| 9 * Example: | |
| 10 * | |
| 11 * <iron-animated-pages> | |
| 12 * <settings-signin-page prefs="{{prefs}}"></settings-signin-page> | |
| 13 * ... other pages ... | |
| 14 * </iron-animated-pages> | |
| 15 * | |
| 16 * @group Chrome Settings Elements | |
| 17 * @element settings-signin-page | |
| 18 */ | |
| 19 Polymer({ | |
| 20 is: 'settings-signin-page', | |
| 21 | |
| 22 behaviors: [ | |
| 23 I18nBehavior, | |
| 24 ], | |
| 25 | |
| 26 properties: { | |
| 27 /** | |
| 28 * The current active route. | |
| 29 */ | |
| 30 currentRoute: { | |
| 31 type: Object, | |
| 32 notify: true, | |
| 33 }, | |
| 34 | |
| 35 /** | |
| 36 * The current sync status, supplied by settings.SyncPrivateApi. | |
| 37 * @type {?settings.SyncPrivateApi.SyncStatus} | |
| 38 */ | |
| 39 syncStatus: Object, | |
| 40 }, | |
| 41 | |
| 42 created: function() { | |
| 43 settings.SyncPrivateApi.getSyncStatus( | |
| 44 this.handleSyncStatusFetched_.bind(this)); | |
| 45 }, | |
| 46 | |
| 47 /** | |
| 48 * Handler for when the sync state is pushed from settings.SyncPrivateApi. | |
| 49 * @private | |
| 50 */ | |
| 51 handleSyncStatusFetched_: function(syncStatus) { | |
| 52 this.syncStatus = syncStatus; | |
| 53 | |
| 54 // TODO(tommycli): Remove once we figure out how to refactor the sync | |
| 55 // code to not include HTML in the status messages. | |
| 56 this.$.syncStatusText.innerHTML = syncStatus.statusText; | |
| 57 }, | |
| 58 | |
| 59 /** @private */ | |
| 60 onActionLinkTap_: function() { | |
| 61 settings.SyncPrivateApi.showSetupUI(); | |
| 62 }, | |
| 63 | |
| 64 /** @private */ | |
| 65 onSigninTap_: function() { | |
| 66 settings.SyncPrivateApi.startSignIn(); | |
| 67 }, | |
| 68 | |
| 69 /** @private */ | |
| 70 onDisconnectTap_: function() { | |
| 71 this.$.disconnectDialog.open(); | |
| 72 }, | |
| 73 | |
| 74 /** @private */ | |
| 75 onDisconnectConfirm_: function() { | |
| 76 var deleteProfile = this.$.deleteProfile && this.$.deleteProfile.checked; | |
| 77 settings.SyncPrivateApi.disconnect(deleteProfile); | |
| 78 | |
| 79 // Dialog automatically closed because button has dialog-confirm attribute. | |
| 80 }, | |
| 81 | |
| 82 /** @private */ | |
| 83 onSyncTap_: function() { | |
| 84 this.$.pages.setSubpageChain(['sync']); | |
| 85 }, | |
| 86 | |
| 87 /** @private */ | |
| 88 onManageOtherPeople_: function() { | |
| 89 settings.SyncPrivateApi.manageOtherPeople(); | |
| 90 }, | |
| 91 | |
| 92 /** | |
| 93 * @private | |
| 94 * @return {boolean} | |
| 95 */ | |
| 96 isStatusTextSet_: function(syncStatus) { | |
| 97 return syncStatus && syncStatus.statusText.length > 0; | |
| 98 }, | |
| 99 | |
| 100 /** | |
| 101 * @private | |
| 102 * @return {boolean} | |
| 103 */ | |
| 104 isAdvancedSyncSettingsVisible_: function(syncStatus) { | |
| 105 return syncStatus && syncStatus.signedIn && !syncStatus.managed && | |
| 106 syncStatus.syncSystemEnabled; | |
| 107 }, | |
| 108 }); | |
| OLD | NEW |