| 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', |
| 11 | 11 |
| 12 behaviors: [ | 12 behaviors: [ |
| 13 settings.RouteObserverBehavior, | |
| 14 I18nBehavior, | 13 I18nBehavior, |
| 15 WebUIListenerBehavior, | 14 WebUIListenerBehavior, |
| 16 <if expr="chromeos"> | 15 <if expr="chromeos"> |
| 17 LockStateBehavior, | 16 LockStateBehavior, |
| 18 </if> | 17 </if> |
| 19 ], | 18 ], |
| 20 | 19 |
| 21 properties: { | 20 properties: { |
| 22 /** | 21 /** |
| 23 * Preferences state. | 22 * Preferences state. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (this.easyUnlockAllowed_) { | 132 if (this.easyUnlockAllowed_) { |
| 134 this.addWebUIListener( | 133 this.addWebUIListener( |
| 135 'easy-unlock-enabled-status', | 134 'easy-unlock-enabled-status', |
| 136 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 135 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
| 137 this.easyUnlockBrowserProxy_.getEnabledStatus().then( | 136 this.easyUnlockBrowserProxy_.getEnabledStatus().then( |
| 138 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 137 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
| 139 } | 138 } |
| 140 </if> | 139 </if> |
| 141 }, | 140 }, |
| 142 | 141 |
| 143 /** @protected */ | |
| 144 currentRouteChanged: function() { | |
| 145 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) | |
| 146 this.$.disconnectDialog.showModal(); | |
| 147 else if (this.$.disconnectDialog.open) | |
| 148 this.$.disconnectDialog.close(); | |
| 149 }, | |
| 150 | |
| 151 <if expr="chromeos"> | 142 <if expr="chromeos"> |
| 152 /** @private */ | 143 /** @private */ |
| 153 getPasswordState_: function(hasPin, enableScreenLock) { | 144 getPasswordState_: function(hasPin, enableScreenLock) { |
| 154 if (!enableScreenLock) | 145 if (!enableScreenLock) |
| 155 return this.i18n('lockScreenNone'); | 146 return this.i18n('lockScreenNone'); |
| 156 if (hasPin) | 147 if (hasPin) |
| 157 return this.i18n('lockScreenPinOrPassword'); | 148 return this.i18n('lockScreenPinOrPassword'); |
| 158 return this.i18n('lockScreenPasswordOnly'); | 149 return this.i18n('lockScreenPasswordOnly'); |
| 159 }, | 150 }, |
| 160 </if> | 151 </if> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 this.syncBrowserProxy_.openActivityControlsUrl(); | 210 this.syncBrowserProxy_.openActivityControlsUrl(); |
| 220 }, | 211 }, |
| 221 | 212 |
| 222 /** @private */ | 213 /** @private */ |
| 223 onSigninTap_: function() { | 214 onSigninTap_: function() { |
| 224 this.syncBrowserProxy_.startSignIn(); | 215 this.syncBrowserProxy_.startSignIn(); |
| 225 }, | 216 }, |
| 226 | 217 |
| 227 /** @private */ | 218 /** @private */ |
| 228 onDisconnectTap_: function() { | 219 onDisconnectTap_: function() { |
| 229 settings.navigateTo(settings.Route.SIGN_OUT); | 220 this.$.disconnectDialog.showModal(); |
| 230 }, | 221 }, |
| 231 | 222 |
| 232 /** @private */ | 223 /** @private */ |
| 233 onDisconnectCancel_: function() { | 224 onDisconnectCancel_: function() { |
| 234 settings.navigateToPreviousRoute(); | 225 this.$.disconnectDialog.close(); |
| 235 }, | 226 }, |
| 236 | 227 |
| 237 /** @private */ | 228 /** @private */ |
| 238 onDisconnectConfirm_: function() { | 229 onDisconnectConfirm_: function() { |
| 239 var deleteProfile = !!this.syncStatus.domain || | 230 var deleteProfile = !!this.syncStatus.domain || |
| 240 (this.$.deleteProfile && this.$.deleteProfile.checked); | 231 (this.$.deleteProfile && this.$.deleteProfile.checked); |
| 241 this.syncBrowserProxy_.signOut(deleteProfile); | 232 this.syncBrowserProxy_.signOut(deleteProfile); |
| 242 | 233 |
| 243 settings.navigateToPreviousRoute(); | 234 this.$.disconnectDialog.close(); |
| 244 }, | 235 }, |
| 245 | 236 |
| 246 /** @private */ | 237 /** @private */ |
| 247 onSyncTap_: function() { | 238 onSyncTap_: function() { |
| 248 assert(this.syncStatus.signedIn); | 239 assert(this.syncStatus.signedIn); |
| 249 assert(this.syncStatus.syncSystemEnabled); | 240 assert(this.syncStatus.syncSystemEnabled); |
| 250 | 241 |
| 251 if (this.syncStatus.managed) | 242 if (this.syncStatus.managed) |
| 252 return; | 243 return; |
| 253 | 244 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 334 |
| 344 /** | 335 /** |
| 345 * @param {string} iconUrl | 336 * @param {string} iconUrl |
| 346 * @return {string} A CSS imageset for multiple scale factors. | 337 * @return {string} A CSS imageset for multiple scale factors. |
| 347 * @private | 338 * @private |
| 348 */ | 339 */ |
| 349 getIconImageset_: function(iconUrl) { | 340 getIconImageset_: function(iconUrl) { |
| 350 return cr.icon.getProfileAvatarIcon(iconUrl); | 341 return cr.icon.getProfileAvatarIcon(iconUrl); |
| 351 }, | 342 }, |
| 352 }); | 343 }); |
| OLD | NEW |