| 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, |
| 48 }, | 60 }, |
| 49 | 61 |
| 62 /** @override */ |
| 50 created: function() { | 63 created: function() { |
| 64 settings.SyncPrivateApi.getProfileInfo(this.handleProfileInfo_.bind(this)); |
| 51 settings.SyncPrivateApi.getSyncStatus( | 65 settings.SyncPrivateApi.getSyncStatus( |
| 52 this.handleSyncStatusFetched_.bind(this)); | 66 this.handleSyncStatusFetched_.bind(this)); |
| 53 }, | 67 }, |
| 54 | 68 |
| 55 /** | 69 /** |
| 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 /** |
| 56 * Handler for when the sync state is pushed from settings.SyncPrivateApi. | 81 * Handler for when the sync state is pushed from settings.SyncPrivateApi. |
| 57 * @private | 82 * @private |
| 58 */ | 83 */ |
| 59 handleSyncStatusFetched_: function(syncStatus) { | 84 handleSyncStatusFetched_: function(syncStatus) { |
| 60 this.syncStatus = syncStatus; | 85 this.syncStatus = syncStatus; |
| 61 | 86 |
| 62 // TODO(tommycli): Remove once we figure out how to refactor the sync | 87 // TODO(tommycli): Remove once we figure out how to refactor the sync |
| 63 // code to not include HTML in the status messages. | 88 // code to not include HTML in the status messages. |
| 64 this.$.syncStatusText.innerHTML = syncStatus.statusText; | 89 this.$.syncStatusText.innerHTML = syncStatus.statusText; |
| 65 }, | 90 }, |
| 66 | 91 |
| 67 /** @private */ | 92 /** @private */ |
| 68 onActionLinkTap_: function() { | 93 onActionLinkTap_: function() { |
| 69 settings.SyncPrivateApi.showSetupUI(); | 94 settings.SyncPrivateApi.showSetupUI(); |
| 70 }, | 95 }, |
| 71 | 96 |
| 72 /** @private */ | 97 /** @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 */ |
| 73 onSigninTap_: function() { | 106 onSigninTap_: function() { |
| 74 settings.SyncPrivateApi.startSignIn(); | 107 settings.SyncPrivateApi.startSignIn(); |
| 75 }, | 108 }, |
| 76 | 109 |
| 77 /** @private */ | 110 /** @private */ |
| 78 onDisconnectTap_: function() { | 111 onDisconnectTap_: function() { |
| 79 this.$.disconnectDialog.open(); | 112 this.$.disconnectDialog.open(); |
| 80 }, | 113 }, |
| 81 | 114 |
| 82 /** @private */ | 115 /** @private */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 112 | 145 |
| 113 /** | 146 /** |
| 114 * @private | 147 * @private |
| 115 * @return {boolean} | 148 * @return {boolean} |
| 116 */ | 149 */ |
| 117 isAdvancedSyncSettingsVisible_: function(syncStatus) { | 150 isAdvancedSyncSettingsVisible_: function(syncStatus) { |
| 118 return syncStatus && syncStatus.signedIn && !syncStatus.managed && | 151 return syncStatus && syncStatus.signedIn && !syncStatus.managed && |
| 119 syncStatus.syncSystemEnabled; | 152 syncStatus.syncSystemEnabled; |
| 120 }, | 153 }, |
| 121 }); | 154 }); |
| OLD | NEW |