| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 /** @private */ | 225 /** @private */ |
| 226 onSigninTap_: function() { | 226 onSigninTap_: function() { |
| 227 this.syncBrowserProxy_.startSignIn(); | 227 this.syncBrowserProxy_.startSignIn(); |
| 228 }, | 228 }, |
| 229 | 229 |
| 230 /** @private */ | 230 /** @private */ |
| 231 onDisconnectClosed_: function() { | 231 onDisconnectClosed_: function() { |
| 232 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) | 232 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) |
| 233 settings.navigateToPreviousRoute(); | 233 settings.navigateToPreviousRoute(); |
| 234 window.dispatchEvent(new Event('signout-dialog-closed')); |
| 234 }, | 235 }, |
| 235 | 236 |
| 236 /** @private */ | 237 /** @private */ |
| 237 onDisconnectTap_: function() { | 238 onDisconnectTap_: function() { |
| 238 settings.navigateTo(settings.Route.SIGN_OUT); | 239 settings.navigateTo(settings.Route.SIGN_OUT); |
| 239 }, | 240 }, |
| 240 | 241 |
| 241 /** @private */ | 242 /** @private */ |
| 242 onDisconnectCancel_: function() { | 243 onDisconnectCancel_: function() { |
| 243 this.$.disconnectDialog.close(); | 244 this.$.disconnectDialog.close(); |
| 244 }, | 245 }, |
| 245 | 246 |
| 246 /** @private */ | 247 /** @private */ |
| 247 onDisconnectConfirm_: function() { | 248 onDisconnectConfirm_: function() { |
| 248 var deleteProfile = !!this.syncStatus.domain || | 249 var deleteProfile = !!this.syncStatus.domain || |
| 249 (this.$.deleteProfile && this.$.deleteProfile.checked); | 250 (this.$.deleteProfile && this.$.deleteProfile.checked); |
| 250 this.syncBrowserProxy_.signOut(deleteProfile); | 251 // Close the dialog and navigate to previous route before signout so |
| 251 | 252 // session restore does not restore to the signout dialog. |
| 252 this.$.disconnectDialog.close(); | 253 this.$.disconnectDialog.close(); |
| 254 // If user visit the signout dialog by typing in the address bar, there |
| 255 // will be no previous browsing history so signout right after the dialog |
| 256 // being closed. Otherwise, signout after the route has been navigated to |
| 257 // the privious one with a callback. |
| 258 var signoutEvent = 'signout-dialog-closed'; |
| 259 if (settings.isPreviousRouteExistedInHistory()) |
| 260 signoutEvent = 'popstate'; |
| 261 listenOnce(window, signoutEvent, function callback() { |
| 262 this.syncBrowserProxy_.signOut(deleteProfile); |
| 263 }.bind(this)); |
| 253 }, | 264 }, |
| 254 | 265 |
| 255 /** @private */ | 266 /** @private */ |
| 256 onSyncTap_: function() { | 267 onSyncTap_: function() { |
| 257 assert(this.syncStatus.signedIn); | 268 assert(this.syncStatus.signedIn); |
| 258 assert(this.syncStatus.syncSystemEnabled); | 269 assert(this.syncStatus.syncSystemEnabled); |
| 259 | 270 |
| 260 if (this.syncStatus.managed) | 271 if (this.syncStatus.managed) |
| 261 return; | 272 return; |
| 262 | 273 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 372 |
| 362 /** | 373 /** |
| 363 * @param {!settings.SyncStatus} syncStatus | 374 * @param {!settings.SyncStatus} syncStatus |
| 364 * @return {boolean} Whether to show the "Sign in to Chrome" button. | 375 * @return {boolean} Whether to show the "Sign in to Chrome" button. |
| 365 * @private | 376 * @private |
| 366 */ | 377 */ |
| 367 showSignin_: function(syncStatus) { | 378 showSignin_: function(syncStatus) { |
| 368 return !!syncStatus.signinAllowed && !syncStatus.signedIn; | 379 return !!syncStatus.signinAllowed && !syncStatus.signedIn; |
| 369 }, | 380 }, |
| 370 }); | 381 }); |
| OLD | NEW |