| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 * @private | 90 * @private |
| 91 */ | 91 */ |
| 92 quickUnlockEnabled_: { | 92 quickUnlockEnabled_: { |
| 93 type: Boolean, | 93 type: Boolean, |
| 94 value: function() { | 94 value: function() { |
| 95 return loadTimeData.getBoolean('pinUnlockEnabled') || | 95 return loadTimeData.getBoolean('pinUnlockEnabled') || |
| 96 loadTimeData.getBoolean('fingerprintUnlockEnabled'); | 96 loadTimeData.getBoolean('fingerprintUnlockEnabled'); |
| 97 }, | 97 }, |
| 98 readOnly: true, | 98 readOnly: true, |
| 99 }, | 99 }, |
| 100 | |
| 101 /** @private {!settings.EasyUnlockBrowserProxy} */ | |
| 102 easyUnlockBrowserProxy_: { | |
| 103 type: Object, | |
| 104 value: function() { | |
| 105 return settings.EasyUnlockBrowserProxyImpl.getInstance(); | |
| 106 }, | |
| 107 }, | |
| 108 | |
| 109 /** | |
| 110 * True if Easy Unlock is allowed on this machine. | |
| 111 */ | |
| 112 easyUnlockAllowed_: { | |
| 113 type: Boolean, | |
| 114 value: function() { | |
| 115 return loadTimeData.getBoolean('easyUnlockAllowed'); | |
| 116 }, | |
| 117 readOnly: true, | |
| 118 }, | |
| 119 | |
| 120 /** | |
| 121 * True if Easy Unlock is enabled. | |
| 122 */ | |
| 123 easyUnlockEnabled_: { | |
| 124 type: Boolean, | |
| 125 value: function() { | |
| 126 return loadTimeData.getBoolean('easyUnlockEnabled'); | |
| 127 }, | |
| 128 }, | |
| 129 | |
| 130 /** | |
| 131 * True if Easy Unlock's proximity detection feature is allowed. | |
| 132 */ | |
| 133 easyUnlockProximityDetectionAllowed_: { | |
| 134 type: Boolean, | |
| 135 value: function() { | |
| 136 return loadTimeData.getBoolean('easyUnlockAllowed') && | |
| 137 loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed'); | |
| 138 }, | |
| 139 readOnly: true, | |
| 140 }, | |
| 141 | |
| 142 /** @private */ | |
| 143 showEasyUnlockTurnOffDialog_: { | |
| 144 type: Boolean, | |
| 145 value: false, | |
| 146 }, | |
| 147 // </if> | 100 // </if> |
| 148 }, | 101 }, |
| 149 | 102 |
| 150 /** @override */ | 103 /** @override */ |
| 151 attached: function() { | 104 attached: function() { |
| 152 var profileInfoProxy = settings.ProfileInfoBrowserProxyImpl.getInstance(); | 105 var profileInfoProxy = settings.ProfileInfoBrowserProxyImpl.getInstance(); |
| 153 profileInfoProxy.getProfileInfo().then(this.handleProfileInfo_.bind(this)); | 106 profileInfoProxy.getProfileInfo().then(this.handleProfileInfo_.bind(this)); |
| 154 this.addWebUIListener('profile-info-changed', | 107 this.addWebUIListener('profile-info-changed', |
| 155 this.handleProfileInfo_.bind(this)); | 108 this.handleProfileInfo_.bind(this)); |
| 156 | 109 |
| 157 profileInfoProxy.getProfileManagesSupervisedUsers().then( | 110 profileInfoProxy.getProfileManagesSupervisedUsers().then( |
| 158 this.handleProfileManagesSupervisedUsers_.bind(this)); | 111 this.handleProfileManagesSupervisedUsers_.bind(this)); |
| 159 this.addWebUIListener('profile-manages-supervised-users-changed', | 112 this.addWebUIListener('profile-manages-supervised-users-changed', |
| 160 this.handleProfileManagesSupervisedUsers_.bind(this)); | 113 this.handleProfileManagesSupervisedUsers_.bind(this)); |
| 161 | 114 |
| 162 this.addWebUIListener('profile-stats-count-ready', | 115 this.addWebUIListener('profile-stats-count-ready', |
| 163 this.handleProfileStatsCount_.bind(this)); | 116 this.handleProfileStatsCount_.bind(this)); |
| 164 | 117 |
| 165 this.syncBrowserProxy_.getSyncStatus().then( | 118 this.syncBrowserProxy_.getSyncStatus().then( |
| 166 this.handleSyncStatus_.bind(this)); | 119 this.handleSyncStatus_.bind(this)); |
| 167 this.addWebUIListener('sync-status-changed', | 120 this.addWebUIListener('sync-status-changed', |
| 168 this.handleSyncStatus_.bind(this)); | 121 this.handleSyncStatus_.bind(this)); |
| 169 | |
| 170 // <if expr="chromeos"> | |
| 171 if (this.easyUnlockAllowed_) { | |
| 172 this.addWebUIListener( | |
| 173 'easy-unlock-enabled-status', | |
| 174 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | |
| 175 this.easyUnlockBrowserProxy_.getEnabledStatus().then( | |
| 176 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | |
| 177 } | |
| 178 // </if> | |
| 179 }, | 122 }, |
| 180 | 123 |
| 181 /** @protected */ | 124 /** @protected */ |
| 182 currentRouteChanged: function() { | 125 currentRouteChanged: function() { |
| 183 this.showImportDataDialog_ = | 126 this.showImportDataDialog_ = |
| 184 settings.getCurrentRoute() == settings.Route.IMPORT_DATA; | 127 settings.getCurrentRoute() == settings.Route.IMPORT_DATA; |
| 185 | 128 |
| 186 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { | 129 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { |
| 187 // If the sync status has not been fetched yet, optimistically display | 130 // If the sync status has not been fetched yet, optimistically display |
| 188 // the disconnect dialog. There is another check when the sync status is | 131 // the disconnect dialog. There is another check when the sync status is |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (syncStatus.signedIn) | 202 if (syncStatus.signedIn) |
| 260 settings.ProfileInfoBrowserProxyImpl.getInstance().getProfileStatsCount(); | 203 settings.ProfileInfoBrowserProxyImpl.getInstance().getProfileStatsCount(); |
| 261 // </if> | 204 // </if> |
| 262 | 205 |
| 263 if (!syncStatus.signedIn && this.showDisconnectDialog_) | 206 if (!syncStatus.signedIn && this.showDisconnectDialog_) |
| 264 this.$$('#disconnectDialog').close(); | 207 this.$$('#disconnectDialog').close(); |
| 265 | 208 |
| 266 this.syncStatus = syncStatus; | 209 this.syncStatus = syncStatus; |
| 267 }, | 210 }, |
| 268 | 211 |
| 269 // <if expr="chromeos"> | |
| 270 /** | |
| 271 * Handler for when the Easy Unlock enabled status has changed. | |
| 272 * @private | |
| 273 */ | |
| 274 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { | |
| 275 this.easyUnlockEnabled_ = easyUnlockEnabled; | |
| 276 this.showEasyUnlockTurnOffDialog_ = | |
| 277 easyUnlockEnabled && this.showEasyUnlockTurnOffDialog_; | |
| 278 }, | |
| 279 // </if> | |
| 280 | |
| 281 /** @private */ | 212 /** @private */ |
| 282 onPictureTap_: function() { | 213 onPictureTap_: function() { |
| 283 // <if expr="chromeos"> | 214 // <if expr="chromeos"> |
| 284 settings.navigateTo(settings.Route.CHANGE_PICTURE); | 215 settings.navigateTo(settings.Route.CHANGE_PICTURE); |
| 285 // </if> | 216 // </if> |
| 286 // <if expr="not chromeos"> | 217 // <if expr="not chromeos"> |
| 287 settings.navigateTo(settings.Route.MANAGE_PROFILE); | 218 settings.navigateTo(settings.Route.MANAGE_PROFILE); |
| 288 // </if> | 219 // </if> |
| 289 }, | 220 }, |
| 290 | 221 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 default: | 305 default: |
| 375 settings.navigateTo(settings.Route.SYNC); | 306 settings.navigateTo(settings.Route.SYNC); |
| 376 } | 307 } |
| 377 }, | 308 }, |
| 378 | 309 |
| 379 // <if expr="chromeos"> | 310 // <if expr="chromeos"> |
| 380 /** @private */ | 311 /** @private */ |
| 381 onConfigureLockTap_: function() { | 312 onConfigureLockTap_: function() { |
| 382 settings.navigateTo(settings.Route.LOCK_SCREEN); | 313 settings.navigateTo(settings.Route.LOCK_SCREEN); |
| 383 }, | 314 }, |
| 384 | |
| 385 /** @private */ | |
| 386 onEasyUnlockSetupTap_: function() { | |
| 387 this.easyUnlockBrowserProxy_.startTurnOnFlow(); | |
| 388 }, | |
| 389 | |
| 390 /** | |
| 391 * @param {!Event} e | |
| 392 * @private | |
| 393 */ | |
| 394 onEasyUnlockTurnOffTap_: function(e) { | |
| 395 e.preventDefault(); | |
| 396 this.showEasyUnlockTurnOffDialog_ = true; | |
| 397 }, | |
| 398 | |
| 399 /** @private */ | |
| 400 onEasyUnlockTurnOffDialogClose_: function() { | |
| 401 this.showEasyUnlockTurnOffDialog_ = false; | |
| 402 }, | |
| 403 // </if> | 315 // </if> |
| 404 | 316 |
| 405 /** @private */ | 317 /** @private */ |
| 406 onManageOtherPeople_: function() { | 318 onManageOtherPeople_: function() { |
| 407 // <if expr="not chromeos"> | 319 // <if expr="not chromeos"> |
| 408 this.syncBrowserProxy_.manageOtherPeople(); | 320 this.syncBrowserProxy_.manageOtherPeople(); |
| 409 // </if> | 321 // </if> |
| 410 // <if expr="chromeos"> | 322 // <if expr="chromeos"> |
| 411 settings.navigateTo(settings.Route.ACCOUNTS); | 323 settings.navigateTo(settings.Route.ACCOUNTS); |
| 412 // </if> | 324 // </if> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 431 |
| 520 /** | 432 /** |
| 521 * @param {!settings.SyncStatus} syncStatus | 433 * @param {!settings.SyncStatus} syncStatus |
| 522 * @return {boolean} Whether to show the "Sign in to Chrome" button. | 434 * @return {boolean} Whether to show the "Sign in to Chrome" button. |
| 523 * @private | 435 * @private |
| 524 */ | 436 */ |
| 525 showSignin_: function(syncStatus) { | 437 showSignin_: function(syncStatus) { |
| 526 return !!syncStatus.signinAllowed && !syncStatus.signedIn; | 438 return !!syncStatus.signinAllowed && !syncStatus.signedIn; |
| 527 }, | 439 }, |
| 528 }); | 440 }); |
| OLD | NEW |