Chromium Code Reviews| 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', |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 131 |
| 132 <if expr="chromeos"> | 132 <if expr="chromeos"> |
| 133 if (this.easyUnlockAllowed_) { | 133 if (this.easyUnlockAllowed_) { |
| 134 this.addWebUIListener( | 134 this.addWebUIListener( |
| 135 'easy-unlock-enabled-status', | 135 'easy-unlock-enabled-status', |
| 136 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 136 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
| 137 this.easyUnlockBrowserProxy_.getEnabledStatus().then( | 137 this.easyUnlockBrowserProxy_.getEnabledStatus().then( |
| 138 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 138 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
| 139 } | 139 } |
| 140 </if> | 140 </if> |
| 141 this.needSignout = false; | |
| 141 }, | 142 }, |
| 142 | 143 |
| 143 /** @protected */ | 144 /** @protected */ |
| 144 currentRouteChanged: function() { | 145 currentRouteChanged: function() { |
| 145 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) | 146 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) |
| 146 this.$.disconnectDialog.showModal(); | 147 this.$.disconnectDialog.showModal(); |
| 147 else if (this.$.disconnectDialog.open) | 148 else if (this.$.disconnectDialog.open) |
| 148 this.$.disconnectDialog.close(); | 149 this.$.disconnectDialog.close(); |
| 149 }, | 150 }, |
| 150 | 151 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 onActivityControlsTap_: function() { | 222 onActivityControlsTap_: function() { |
| 222 this.syncBrowserProxy_.openActivityControlsUrl(); | 223 this.syncBrowserProxy_.openActivityControlsUrl(); |
| 223 }, | 224 }, |
| 224 | 225 |
| 225 /** @private */ | 226 /** @private */ |
| 226 onSigninTap_: function() { | 227 onSigninTap_: function() { |
| 227 this.syncBrowserProxy_.startSignIn(); | 228 this.syncBrowserProxy_.startSignIn(); |
| 228 }, | 229 }, |
| 229 | 230 |
| 230 /** @private */ | 231 /** @private */ |
| 231 onDisconnectClosed_: function() { | 232 onDisconnectClosed_: function() { |
|
tommycli
2016/10/25 18:20:21
This is fired when a Javascript dialog closes, so
zmin
2016/10/25 18:52:12
Browser window closing is triggered by signout whe
tommycli
2016/10/25 19:03:30
I see. If that's all you need, I suggest within th
zmin
2016/10/25 21:02:58
Done.
| |
| 232 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) | 233 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { |
| 233 settings.navigateToPreviousRoute(); | 234 settings.navigateToPreviousRoute(); |
| 235 // Do the signout in the end because it will close all windows when force | |
| 236 // signin enabled. | |
| 237 setTimeout(function() { | |
| 238 if (this.needSignout) | |
| 239 this.syncBrowserProxy_.signOut(this.deleteProfile); | |
| 240 }.bind(this)); | |
| 241 } | |
| 234 }, | 242 }, |
| 235 | 243 |
| 236 /** @private */ | 244 /** @private */ |
| 237 onDisconnectTap_: function() { | 245 onDisconnectTap_: function() { |
| 238 settings.navigateTo(settings.Route.SIGN_OUT); | 246 settings.navigateTo(settings.Route.SIGN_OUT); |
| 239 }, | 247 }, |
| 240 | 248 |
| 241 /** @private */ | 249 /** @private */ |
| 242 onDisconnectCancel_: function() { | 250 onDisconnectCancel_: function() { |
| 243 this.$.disconnectDialog.close(); | 251 this.$.disconnectDialog.close(); |
| 244 }, | 252 }, |
| 245 | 253 |
| 246 /** @private */ | 254 /** @private */ |
| 247 onDisconnectConfirm_: function() { | 255 onDisconnectConfirm_: function() { |
| 248 var deleteProfile = !!this.syncStatus.domain || | 256 var deleteProfile = !!this.syncStatus.domain || |
| 249 (this.$.deleteProfile && this.$.deleteProfile.checked); | 257 (this.$.deleteProfile && this.$.deleteProfile.checked); |
| 250 this.syncBrowserProxy_.signOut(deleteProfile); | 258 this.needSignout = true; |
| 251 | 259 this.deleteProfile = deleteProfile; |
| 252 this.$.disconnectDialog.close(); | 260 this.$.disconnectDialog.close(); |
| 253 }, | 261 }, |
| 254 | 262 |
| 255 /** @private */ | 263 /** @private */ |
| 256 onSyncTap_: function() { | 264 onSyncTap_: function() { |
| 257 assert(this.syncStatus.signedIn); | 265 assert(this.syncStatus.signedIn); |
| 258 assert(this.syncStatus.syncSystemEnabled); | 266 assert(this.syncStatus.syncSystemEnabled); |
| 259 | 267 |
| 260 if (this.syncStatus.managed) | 268 if (this.syncStatus.managed) |
| 261 return; | 269 return; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 }, | 368 }, |
| 361 | 369 |
| 362 /** | 370 /** |
| 363 * @return {boolean} Whether to show the "Sign in to Chrome" button. | 371 * @return {boolean} Whether to show the "Sign in to Chrome" button. |
| 364 * @private | 372 * @private |
| 365 */ | 373 */ |
| 366 showSignin_: function(syncStatus) { | 374 showSignin_: function(syncStatus) { |
| 367 return !!syncStatus.signinAllowed && !syncStatus.signedIn; | 375 return !!syncStatus.signinAllowed && !syncStatus.signedIn; |
| 368 }, | 376 }, |
| 369 }); | 377 }); |
| OLD | NEW |