| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // </if> | 74 // </if> |
| 75 | 75 |
| 76 /** @private {!settings.SyncBrowserProxy} */ | 76 /** @private {!settings.SyncBrowserProxy} */ |
| 77 syncBrowserProxy_: { | 77 syncBrowserProxy_: { |
| 78 type: Object, | 78 type: Object, |
| 79 value: function() { | 79 value: function() { |
| 80 return settings.SyncBrowserProxyImpl.getInstance(); | 80 return settings.SyncBrowserProxyImpl.getInstance(); |
| 81 }, | 81 }, |
| 82 }, | 82 }, |
| 83 | 83 |
| 84 /** @private */ |
| 85 showDisconnectDialog_: Boolean, |
| 86 |
| 84 // <if expr="chromeos"> | 87 // <if expr="chromeos"> |
| 85 /** | 88 /** |
| 86 * True if quick unlock settings should be displayed on this machine. | 89 * True if quick unlock settings should be displayed on this machine. |
| 87 * @private | 90 * @private |
| 88 */ | 91 */ |
| 89 quickUnlockEnabled_: { | 92 quickUnlockEnabled_: { |
| 90 type: Boolean, | 93 type: Boolean, |
| 91 value: function() { | 94 value: function() { |
| 92 return loadTimeData.getBoolean('pinUnlockEnabled') || | 95 return loadTimeData.getBoolean('pinUnlockEnabled') || |
| 93 loadTimeData.getBoolean('fingerprintUnlockEnabled'); | 96 loadTimeData.getBoolean('fingerprintUnlockEnabled'); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 180 |
| 178 /** @protected */ | 181 /** @protected */ |
| 179 currentRouteChanged: function() { | 182 currentRouteChanged: function() { |
| 180 this.showImportDataDialog_ = | 183 this.showImportDataDialog_ = |
| 181 settings.getCurrentRoute() == settings.Route.IMPORT_DATA; | 184 settings.getCurrentRoute() == settings.Route.IMPORT_DATA; |
| 182 | 185 |
| 183 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { | 186 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { |
| 184 // If the sync status has not been fetched yet, optimistically display | 187 // If the sync status has not been fetched yet, optimistically display |
| 185 // the disconnect dialog. There is another check when the sync status is | 188 // the disconnect dialog. There is another check when the sync status is |
| 186 // fetched. The dialog will be closed then the user is not signed in. | 189 // fetched. The dialog will be closed then the user is not signed in. |
| 187 if (this.syncStatus && !this.syncStatus.signedIn) | 190 if (this.syncStatus && !this.syncStatus.signedIn) { |
| 188 settings.navigateToPreviousRoute(); | 191 settings.navigateToPreviousRoute(); |
| 189 else | 192 } else { |
| 190 this.$.disconnectDialog.showModal(); | 193 this.showDisconnectDialog_ = true; |
| 191 } else if (this.$.disconnectDialog.open) { | 194 this.async(function() { |
| 192 this.$.disconnectDialog.close(); | 195 this.$$('#disconnectDialog').showModal(); |
| 196 }.bind(this)); |
| 197 } |
| 198 } else if (this.showDisconnectDialog_) { |
| 199 this.$$('#disconnectDialog').close(); |
| 193 } | 200 } |
| 194 }, | 201 }, |
| 195 | 202 |
| 196 // <if expr="chromeos"> | 203 // <if expr="chromeos"> |
| 197 /** @private */ | 204 /** @private */ |
| 198 getPasswordState_: function(hasPin, enableScreenLock) { | 205 getPasswordState_: function(hasPin, enableScreenLock) { |
| 199 if (!enableScreenLock) | 206 if (!enableScreenLock) |
| 200 return this.i18n('lockScreenNone'); | 207 return this.i18n('lockScreenNone'); |
| 201 if (hasPin) | 208 if (hasPin) |
| 202 return this.i18n('lockScreenPinOrPassword'); | 209 return this.i18n('lockScreenPinOrPassword'); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 */ | 253 */ |
| 247 handleSyncStatus_: function(syncStatus) { | 254 handleSyncStatus_: function(syncStatus) { |
| 248 if (!this.syncStatus && syncStatus && !syncStatus.signedIn) | 255 if (!this.syncStatus && syncStatus && !syncStatus.signedIn) |
| 249 chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings'); | 256 chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings'); |
| 250 | 257 |
| 251 // <if expr="not chromeos"> | 258 // <if expr="not chromeos"> |
| 252 if (syncStatus.signedIn) | 259 if (syncStatus.signedIn) |
| 253 settings.ProfileInfoBrowserProxyImpl.getInstance().getProfileStatsCount(); | 260 settings.ProfileInfoBrowserProxyImpl.getInstance().getProfileStatsCount(); |
| 254 // </if> | 261 // </if> |
| 255 | 262 |
| 256 if (!syncStatus.signedIn && this.$.disconnectDialog.open) | 263 if (!syncStatus.signedIn && this.showDisconnectDialog_) |
| 257 this.$.disconnectDialog.close(); | 264 this.$$('#disconnectDialog').close(); |
| 258 | 265 |
| 259 this.syncStatus = syncStatus; | 266 this.syncStatus = syncStatus; |
| 260 }, | 267 }, |
| 261 | 268 |
| 262 // <if expr="chromeos"> | 269 // <if expr="chromeos"> |
| 263 /** | 270 /** |
| 264 * Handler for when the Easy Unlock enabled status has changed. | 271 * Handler for when the Easy Unlock enabled status has changed. |
| 265 * @private | 272 * @private |
| 266 */ | 273 */ |
| 267 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { | 274 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 293 this.syncBrowserProxy_.openActivityControlsUrl(); | 300 this.syncBrowserProxy_.openActivityControlsUrl(); |
| 294 }, | 301 }, |
| 295 | 302 |
| 296 /** @private */ | 303 /** @private */ |
| 297 onSigninTap_: function() { | 304 onSigninTap_: function() { |
| 298 this.syncBrowserProxy_.startSignIn(); | 305 this.syncBrowserProxy_.startSignIn(); |
| 299 }, | 306 }, |
| 300 | 307 |
| 301 /** @private */ | 308 /** @private */ |
| 302 onDisconnectClosed_: function() { | 309 onDisconnectClosed_: function() { |
| 310 this.showDisconnectDialog_ = false; |
| 303 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) | 311 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) |
| 304 settings.navigateToPreviousRoute(); | 312 settings.navigateToPreviousRoute(); |
| 305 this.fire('signout-dialog-closed'); | 313 this.fire('signout-dialog-closed'); |
| 306 }, | 314 }, |
| 307 | 315 |
| 308 /** @private */ | 316 /** @private */ |
| 309 onDisconnectTap_: function() { | 317 onDisconnectTap_: function() { |
| 310 settings.navigateTo(settings.Route.SIGN_OUT); | 318 settings.navigateTo(settings.Route.SIGN_OUT); |
| 311 }, | 319 }, |
| 312 | 320 |
| 313 /** @private */ | 321 /** @private */ |
| 314 onDisconnectCancel_: function() { | 322 onDisconnectCancel_: function() { |
| 315 this.$.disconnectDialog.close(); | 323 this.$$('#disconnectDialog').close(); |
| 316 }, | 324 }, |
| 317 | 325 |
| 318 /** @private */ | 326 /** @private */ |
| 319 onDisconnectConfirm_: function() { | 327 onDisconnectConfirm_: function() { |
| 320 var deleteProfile = !!this.syncStatus.domain || this.deleteProfile_; | 328 var deleteProfile = !!this.syncStatus.domain || this.deleteProfile_; |
| 321 // Trigger the sign out event after the navigateToPreviousRoute(). | 329 // Trigger the sign out event after the navigateToPreviousRoute(). |
| 322 // So that the navigation to the setting page could be finished before the | 330 // So that the navigation to the setting page could be finished before the |
| 323 // sign out if navigateToPreviousRoute() returns synchronously even the | 331 // sign out if navigateToPreviousRoute() returns synchronously even the |
| 324 // browser is closed after the sign out. Otherwise, the navigation will be | 332 // browser is closed after the sign out. Otherwise, the navigation will be |
| 325 // finshed during session restore if the browser is closed before the async | 333 // finshed during session restore if the browser is closed before the async |
| 326 // callback executed. | 334 // callback executed. |
| 327 listenOnce(this, 'signout-dialog-closed', function() { | 335 listenOnce(this, 'signout-dialog-closed', function() { |
| 328 this.syncBrowserProxy_.signOut(deleteProfile); | 336 this.syncBrowserProxy_.signOut(deleteProfile); |
| 329 }.bind(this)); | 337 }.bind(this)); |
| 330 | 338 |
| 331 this.$.disconnectDialog.close(); | 339 this.$$('#disconnectDialog').close(); |
| 332 }, | 340 }, |
| 333 | 341 |
| 334 /** @private */ | 342 /** @private */ |
| 335 onSyncTap_: function() { | 343 onSyncTap_: function() { |
| 336 assert(this.syncStatus.signedIn); | 344 assert(this.syncStatus.signedIn); |
| 337 assert(this.syncStatus.syncSystemEnabled); | 345 assert(this.syncStatus.syncSystemEnabled); |
| 338 | 346 |
| 339 if (!this.isSyncStatusActionable_(this.syncStatus)) | 347 if (!this.isSyncStatusActionable_(this.syncStatus)) |
| 340 return; | 348 return; |
| 341 | 349 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 519 |
| 512 /** | 520 /** |
| 513 * @param {!settings.SyncStatus} syncStatus | 521 * @param {!settings.SyncStatus} syncStatus |
| 514 * @return {boolean} Whether to show the "Sign in to Chrome" button. | 522 * @return {boolean} Whether to show the "Sign in to Chrome" button. |
| 515 * @private | 523 * @private |
| 516 */ | 524 */ |
| 517 showSignin_: function(syncStatus) { | 525 showSignin_: function(syncStatus) { |
| 518 return !!syncStatus.signinAllowed && !syncStatus.signedIn; | 526 return !!syncStatus.signinAllowed && !syncStatus.signedIn; |
| 519 }, | 527 }, |
| 520 }); | 528 }); |
| OLD | NEW |