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 this.dispatchEvent(new Event('signout-dialog-closed')); | |
sky
2016/11/11 00:32:17
I'm not a good reviewer for the changes to this fi
Dan Beam
2016/11/11 01:56:46
this.fire('signout-dialog-closed');
zmin
2016/11/11 22:54:01
Done.
| |
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 // Trigger the sign out event after the navigateToPreviousRoute(). |
252 // So that the navigation to the setting page could be finished before the | |
253 // sign out if navigateToPreviousRoute() returns synchronously even the | |
254 // browser is closed after the sign out. Otherwise, the navigation will be | |
255 // finshed during session restore if the browser is closed before the async | |
256 // callback executed. | |
257 listenOnce(this, 'signout-dialog-closed', function callback() { | |
Dan Beam
2016/11/11 01:56:46
no need to name this "callback", just:
listenOnce
zmin
2016/11/11 22:54:01
Remove callback and, no it can't listen this even
| |
258 this.syncBrowserProxy_.signOut(deleteProfile); | |
259 }.bind(this)); | |
251 | 260 |
252 this.$.disconnectDialog.close(); | 261 this.$.disconnectDialog.close(); |
253 }, | 262 }, |
254 | 263 |
255 /** @private */ | 264 /** @private */ |
256 onSyncTap_: function() { | 265 onSyncTap_: function() { |
257 assert(this.syncStatus.signedIn); | 266 assert(this.syncStatus.signedIn); |
258 assert(this.syncStatus.syncSystemEnabled); | 267 assert(this.syncStatus.syncSystemEnabled); |
259 | 268 |
260 if (!this.isSyncStatusActionable_(this.syncStatus)) | 269 if (!this.isSyncStatusActionable_(this.syncStatus)) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 | 419 |
411 /** | 420 /** |
412 * @param {!settings.SyncStatus} syncStatus | 421 * @param {!settings.SyncStatus} syncStatus |
413 * @return {boolean} Whether to show the "Sign in to Chrome" button. | 422 * @return {boolean} Whether to show the "Sign in to Chrome" button. |
414 * @private | 423 * @private |
415 */ | 424 */ |
416 showSignin_: function(syncStatus) { | 425 showSignin_: function(syncStatus) { |
417 return !!syncStatus.signinAllowed && !syncStatus.signedIn; | 426 return !!syncStatus.signinAllowed && !syncStatus.signedIn; |
418 }, | 427 }, |
419 }); | 428 }); |
OLD | NEW |