| 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 * Example: | 9 * Example: |
| 10 * | 10 * |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 prefs: { | 38 prefs: { |
| 39 type: Object, | 39 type: Object, |
| 40 notify: true, | 40 notify: true, |
| 41 }, | 41 }, |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * The current sync status, supplied by settings.SyncPrivateApi. | 44 * The current sync status, supplied by settings.SyncPrivateApi. |
| 45 * @type {?settings.SyncStatus} | 45 * @type {?settings.SyncStatus} |
| 46 */ | 46 */ |
| 47 syncStatus: Object, | 47 syncStatus: Object, |
| 48 | |
| 49 /** | |
| 50 * The currently selected profile icon URL. May be a data URL. | |
| 51 * @private {string} | |
| 52 */ | |
| 53 profileIconUrl_: String, | |
| 54 | |
| 55 /** | |
| 56 * The current profile name. | |
| 57 * @private {string} | |
| 58 */ | |
| 59 profileName_: String, | |
| 60 }, | 48 }, |
| 61 | 49 |
| 62 /** @override */ | |
| 63 created: function() { | 50 created: function() { |
| 64 settings.SyncPrivateApi.getProfileInfo(this.handleProfileInfo_.bind(this)); | |
| 65 settings.SyncPrivateApi.getSyncStatus( | 51 settings.SyncPrivateApi.getSyncStatus( |
| 66 this.handleSyncStatusFetched_.bind(this)); | 52 this.handleSyncStatusFetched_.bind(this)); |
| 67 }, | 53 }, |
| 68 | 54 |
| 69 /** | 55 /** |
| 70 * Handler for when the profile's icon and name is updated. | |
| 71 * @private | |
| 72 * @param {!string} name | |
| 73 * @param {!string} iconUrl | |
| 74 */ | |
| 75 handleProfileInfo_: function(name, iconUrl) { | |
| 76 this.profileName_ = name; | |
| 77 this.profileIconUrl_ = iconUrl; | |
| 78 }, | |
| 79 | |
| 80 /** | |
| 81 * Handler for when the sync state is pushed from settings.SyncPrivateApi. | 56 * Handler for when the sync state is pushed from settings.SyncPrivateApi. |
| 82 * @private | 57 * @private |
| 83 */ | 58 */ |
| 84 handleSyncStatusFetched_: function(syncStatus) { | 59 handleSyncStatusFetched_: function(syncStatus) { |
| 85 this.syncStatus = syncStatus; | 60 this.syncStatus = syncStatus; |
| 86 | 61 |
| 87 // TODO(tommycli): Remove once we figure out how to refactor the sync | 62 // TODO(tommycli): Remove once we figure out how to refactor the sync |
| 88 // code to not include HTML in the status messages. | 63 // code to not include HTML in the status messages. |
| 89 this.$.syncStatusText.innerHTML = syncStatus.statusText; | 64 this.$.syncStatusText.innerHTML = syncStatus.statusText; |
| 90 }, | 65 }, |
| 91 | 66 |
| 92 /** @private */ | 67 /** @private */ |
| 93 onActionLinkTap_: function() { | 68 onActionLinkTap_: function() { |
| 94 settings.SyncPrivateApi.showSetupUI(); | 69 settings.SyncPrivateApi.showSetupUI(); |
| 95 }, | 70 }, |
| 96 | 71 |
| 97 /** @private */ | 72 /** @private */ |
| 98 onManageProfileTap_: function() { | |
| 99 <if expr="not chromeos"> | |
| 100 this.$.pages.setSubpageChain(['manageProfile']); | |
| 101 </if> | |
| 102 // TODO(tommycli): Implement ChromeOS version. January 2016. | |
| 103 }, | |
| 104 | |
| 105 /** @private */ | |
| 106 onSigninTap_: function() { | 73 onSigninTap_: function() { |
| 107 settings.SyncPrivateApi.startSignIn(); | 74 settings.SyncPrivateApi.startSignIn(); |
| 108 }, | 75 }, |
| 109 | 76 |
| 110 /** @private */ | 77 /** @private */ |
| 111 onDisconnectTap_: function() { | 78 onDisconnectTap_: function() { |
| 112 this.$.disconnectDialog.open(); | 79 this.$.disconnectDialog.open(); |
| 113 }, | 80 }, |
| 114 | 81 |
| 115 /** @private */ | 82 /** @private */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 145 | 112 |
| 146 /** | 113 /** |
| 147 * @private | 114 * @private |
| 148 * @return {boolean} | 115 * @return {boolean} |
| 149 */ | 116 */ |
| 150 isAdvancedSyncSettingsVisible_: function(syncStatus) { | 117 isAdvancedSyncSettingsVisible_: function(syncStatus) { |
| 151 return syncStatus && syncStatus.signedIn && !syncStatus.managed && | 118 return syncStatus && syncStatus.signedIn && !syncStatus.managed && |
| 152 syncStatus.syncSystemEnabled; | 119 syncStatus.syncSystemEnabled; |
| 153 }, | 120 }, |
| 154 }); | 121 }); |
| OLD | NEW |