| 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 * |
| 11 * <iron-animated-pages> | 11 * <iron-animated-pages> |
| 12 * <settings-people-page prefs="{{prefs}}"></settings-people-page> | 12 * <settings-people-page prefs="{{prefs}}"></settings-people-page> |
| 13 * ... other pages ... | 13 * ... other pages ... |
| 14 * </iron-animated-pages> | 14 * </iron-animated-pages> |
| 15 */ | 15 */ |
| 16 Polymer({ | 16 Polymer({ |
| 17 is: 'settings-people-page', | 17 is: 'settings-people-page', |
| 18 | 18 |
| 19 behaviors: [ | 19 behaviors: [ |
| 20 I18nBehavior, | 20 I18nBehavior, |
| 21 WebUIListenerBehavior, |
| 21 ], | 22 ], |
| 22 | 23 |
| 23 properties: { | 24 properties: { |
| 24 /** | 25 /** |
| 25 * The current active route. | 26 * The current active route. |
| 26 */ | 27 */ |
| 27 currentRoute: { | 28 currentRoute: { |
| 28 type: Object, | 29 type: Object, |
| 29 notify: true, | 30 notify: true, |
| 30 }, | 31 }, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 * The currently selected profile icon URL. May be a data URL. | 48 * The currently selected profile icon URL. May be a data URL. |
| 48 * @private {string} | 49 * @private {string} |
| 49 */ | 50 */ |
| 50 profileIconUrl_: String, | 51 profileIconUrl_: String, |
| 51 | 52 |
| 52 /** | 53 /** |
| 53 * The current profile name. | 54 * The current profile name. |
| 54 * @private {string} | 55 * @private {string} |
| 55 */ | 56 */ |
| 56 profileName_: String, | 57 profileName_: String, |
| 58 |
| 59 <if expr="chromeos"> |
| 60 /** |
| 61 * True if Easy Unlock is allowed on this machine. |
| 62 * @private {boolean} |
| 63 */ |
| 64 easyUnlockAllowed_: { |
| 65 type: Boolean, |
| 66 value: function() { |
| 67 return loadTimeData.getBoolean('easyUnlockAllowed'); |
| 68 }, |
| 69 readOnly: true, |
| 70 }, |
| 71 |
| 72 /** |
| 73 * True if Easy Unlock is enabled. |
| 74 * @private {boolean} |
| 75 */ |
| 76 easyUnlockEnabled_: { |
| 77 type: Boolean, |
| 78 value: function() { |
| 79 return loadTimeData.getBoolean('easyUnlockEnabled'); |
| 80 }, |
| 81 }, |
| 82 </if> |
| 57 }, | 83 }, |
| 58 | 84 |
| 59 /** @override */ | 85 /** @override */ |
| 60 created: function() { | 86 attached: function() { |
| 61 settings.SyncPrivateApi.getProfileInfo(this.handleProfileInfo_.bind(this)); | 87 settings.SyncPrivateApi.getProfileInfo(this.handleProfileInfo_.bind(this)); |
| 62 settings.SyncPrivateApi.getSyncStatus( | 88 settings.SyncPrivateApi.getSyncStatus( |
| 63 this.handleSyncStatusFetched_.bind(this)); | 89 this.handleSyncStatusFetched_.bind(this)); |
| 90 |
| 91 <if expr="chromeos"> |
| 92 if (this.easyUnlockAllowed_) { |
| 93 this.addWebUIListener( |
| 94 'easy-unlock-enabled-status', |
| 95 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
| 96 } |
| 97 </if> |
| 64 }, | 98 }, |
| 65 | 99 |
| 66 /** | 100 /** |
| 67 * Handler for when the profile's icon and name is updated. | 101 * Handler for when the profile's icon and name is updated. |
| 68 * @private | 102 * @private |
| 69 * @param {!string} name | 103 * @param {!string} name |
| 70 * @param {!string} iconUrl | 104 * @param {!string} iconUrl |
| 71 */ | 105 */ |
| 72 handleProfileInfo_: function(name, iconUrl) { | 106 handleProfileInfo_: function(name, iconUrl) { |
| 73 this.profileName_ = name; | 107 this.profileName_ = name; |
| 74 this.profileIconUrl_ = iconUrl; | 108 this.profileIconUrl_ = iconUrl; |
| 75 }, | 109 }, |
| 76 | 110 |
| 77 /** | 111 /** |
| 78 * Handler for when the sync state is pushed from settings.SyncPrivateApi. | 112 * Handler for when the sync state is pushed from settings.SyncPrivateApi. |
| 79 * @private | 113 * @private |
| 80 */ | 114 */ |
| 81 handleSyncStatusFetched_: function(syncStatus) { | 115 handleSyncStatusFetched_: function(syncStatus) { |
| 82 this.syncStatus = syncStatus; | 116 this.syncStatus = syncStatus; |
| 83 | 117 |
| 84 // TODO(tommycli): Remove once we figure out how to refactor the sync | 118 // TODO(tommycli): Remove once we figure out how to refactor the sync |
| 85 // code to not include HTML in the status messages. | 119 // code to not include HTML in the status messages. |
| 86 this.$.syncStatusText.innerHTML = syncStatus.statusText; | 120 this.$.syncStatusText.innerHTML = syncStatus.statusText; |
| 87 }, | 121 }, |
| 88 | 122 |
| 123 <if expr="chromeos"> |
| 124 /** |
| 125 * Handler for when the Easy Unlock enabled status has changed. |
| 126 * @private |
| 127 */ |
| 128 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { |
| 129 this.easyUnlockEnabled_ = easyUnlockEnabled; |
| 130 }, |
| 131 </if> |
| 132 |
| 89 /** @private */ | 133 /** @private */ |
| 90 onActionLinkTap_: function() { | 134 onActionLinkTap_: function() { |
| 91 settings.SyncPrivateApi.showSetupUI(); | 135 settings.SyncPrivateApi.showSetupUI(); |
| 92 }, | 136 }, |
| 93 | 137 |
| 94 /** @private */ | 138 /** @private */ |
| 95 onPictureTap_: function() { | 139 onPictureTap_: function() { |
| 96 <if expr="chromeos"> | 140 <if expr="chromeos"> |
| 97 this.$.pages.setSubpageChain(['changePicture']); | 141 this.$.pages.setSubpageChain(['changePicture']); |
| 98 </if> | 142 </if> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 195 |
| 152 /** | 196 /** |
| 153 * @private | 197 * @private |
| 154 * @return {boolean} | 198 * @return {boolean} |
| 155 */ | 199 */ |
| 156 isAdvancedSyncSettingsVisible_: function(syncStatus) { | 200 isAdvancedSyncSettingsVisible_: function(syncStatus) { |
| 157 return syncStatus && syncStatus.signedIn && !syncStatus.managed && | 201 return syncStatus && syncStatus.signedIn && !syncStatus.managed && |
| 158 syncStatus.syncSystemEnabled; | 202 syncStatus.syncSystemEnabled; |
| 159 }, | 203 }, |
| 160 }); | 204 }); |
| OLD | NEW |