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 (function() { | 5 (function() { |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Names of the radio buttons which allow the user to choose his encryption | 8 * Names of the radio buttons which allow the user to choose his encryption |
| 9 * mechanism. | 9 * mechanism. |
| 10 * @enum {string} | 10 * @enum {string} |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 * Whether the "create passphrase" inputs should be shown. These inputs | 92 * Whether the "create passphrase" inputs should be shown. These inputs |
| 93 * give the user the opportunity to use a custom passphrase instead of | 93 * give the user the opportunity to use a custom passphrase instead of |
| 94 * authenticating with his Google credentials. | 94 * authenticating with his Google credentials. |
| 95 * @private | 95 * @private |
| 96 */ | 96 */ |
| 97 creatingNewPassphrase_: { | 97 creatingNewPassphrase_: { |
| 98 type: Boolean, | 98 type: Boolean, |
| 99 value: false, | 99 value: false, |
| 100 }, | 100 }, |
| 101 | 101 |
| 102 /** | |
| 103 * The passphrase input field value. | |
| 104 * @private | |
| 105 */ | |
| 106 passphrase_: { | |
| 107 type: String, | |
| 108 value: '', | |
| 109 }, | |
| 110 | |
| 111 /** | |
| 112 * The passphrase confirmation input field value. | |
| 113 * @private | |
| 114 */ | |
| 115 confirmation_: { | |
|
tommycli
2016/10/25 18:28:46
since you are now binding the values of these inpu
Moe
2016/10/25 22:30:18
Done.
| |
| 116 type: String, | |
| 117 value: '', | |
| 118 }, | |
| 119 | |
| 120 /** | |
| 121 * The existing passphrase input field value. | |
| 122 * @private | |
| 123 */ | |
| 124 existingPassphrase_: { | |
| 125 type: String, | |
| 126 value: '', | |
| 127 }, | |
| 128 | |
| 102 /** @private {!settings.SyncBrowserProxy} */ | 129 /** @private {!settings.SyncBrowserProxy} */ |
| 103 browserProxy_: { | 130 browserProxy_: { |
| 104 type: Object, | 131 type: Object, |
| 105 value: function() { | 132 value: function() { |
| 106 return settings.SyncBrowserProxyImpl.getInstance(); | 133 return settings.SyncBrowserProxyImpl.getInstance(); |
| 107 }, | 134 }, |
| 108 }, | 135 }, |
| 109 | 136 |
| 110 /** | 137 /** |
| 111 * The unload callback is needed because the sign-in flow needs to know | 138 * The unload callback is needed because the sign-in flow needs to know |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 * @private | 280 * @private |
| 254 */ | 281 */ |
| 255 onAutofillDataTypeChanged_: function() { | 282 onAutofillDataTypeChanged_: function() { |
| 256 this.set('syncPrefs.paymentsIntegrationEnabled', | 283 this.set('syncPrefs.paymentsIntegrationEnabled', |
| 257 this.syncPrefs.autofillSynced); | 284 this.syncPrefs.autofillSynced); |
| 258 | 285 |
| 259 this.onSingleSyncDataTypeChanged_(); | 286 this.onSingleSyncDataTypeChanged_(); |
| 260 }, | 287 }, |
| 261 | 288 |
| 262 /** | 289 /** |
| 290 * @param {string} passphrase The passphrase input field value | |
| 291 * @param {string} confirmation The passphrase confirmation input field value. | |
| 292 * @return {boolean} Whether the passphrase save button should be enabled. | |
| 293 * @private | |
| 294 */ | |
| 295 isSaveNewPassphraseEnabled_: function(passphrase, confirmation) { | |
| 296 return passphrase !== '' && confirmation !== ''; | |
| 297 }, | |
| 298 | |
| 299 /** | |
| 263 * Sends the newly created custom sync passphrase to the browser. | 300 * Sends the newly created custom sync passphrase to the browser. |
| 264 * @private | 301 * @private |
| 265 */ | 302 */ |
| 266 onSaveNewPassphraseTap_: function() { | 303 onSaveNewPassphraseTap_: function() { |
| 267 assert(this.creatingNewPassphrase_); | 304 assert(this.creatingNewPassphrase_); |
| 268 | 305 |
| 269 // If a new password has been entered but it is invalid, do not send the | 306 // If a new password has been entered but it is invalid, do not send the |
| 270 // sync state to the API. | 307 // sync state to the API. |
| 271 if (!this.validateCreatedPassphrases_()) | 308 if (!this.validateCreatedPassphrases_()) |
| 272 return; | 309 return; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 * Computed binding returning the selected encryption radio button. | 373 * Computed binding returning the selected encryption radio button. |
| 337 * @private | 374 * @private |
| 338 */ | 375 */ |
| 339 selectedEncryptionRadio_: function() { | 376 selectedEncryptionRadio_: function() { |
| 340 return this.syncPrefs.encryptAllData || this.creatingNewPassphrase_ ? | 377 return this.syncPrefs.encryptAllData || this.creatingNewPassphrase_ ? |
| 341 RadioButtonNames.ENCRYPT_WITH_PASSPHRASE : | 378 RadioButtonNames.ENCRYPT_WITH_PASSPHRASE : |
| 342 RadioButtonNames.ENCRYPT_WITH_GOOGLE; | 379 RadioButtonNames.ENCRYPT_WITH_GOOGLE; |
| 343 }, | 380 }, |
| 344 | 381 |
| 345 /** | 382 /** |
| 346 * Computed binding returning the encryption text body. | 383 * Computed binding returning text of the prompt for entering the passphrase. |
| 347 * @private | 384 * @private |
| 348 */ | 385 */ |
| 349 encryptWithPassphraseBody_: function() { | 386 enterPassphrasePrompt_: function() { |
| 350 if (this.syncPrefs && this.syncPrefs.fullEncryptionBody) | 387 if (this.syncPrefs && this.syncPrefs.passphraseTypeIsCustom) |
| 351 return this.syncPrefs.fullEncryptionBody; | 388 return this.syncPrefs.enterPassphraseBody; |
| 352 | 389 |
| 353 return this.i18n('encryptWithSyncPassphraseLabel'); | 390 return this.syncPrefs.enterGooglePassphraseBody; |
| 354 }, | 391 }, |
| 355 | 392 |
| 356 /** | 393 /** |
| 357 * @param {boolean} syncAllDataTypes | 394 * @param {boolean} syncAllDataTypes |
| 358 * @param {boolean} enforced | 395 * @param {boolean} enforced |
| 359 * @return {boolean} Whether the sync checkbox should be disabled. | 396 * @return {boolean} Whether the sync checkbox should be disabled. |
| 360 */ | 397 */ |
| 361 shouldSyncCheckboxBeDisabled_: function(syncAllDataTypes, enforced) { | 398 shouldSyncCheckboxBeDisabled_: function(syncAllDataTypes, enforced) { |
| 362 return syncAllDataTypes || enforced; | 399 return syncAllDataTypes || enforced; |
| 363 }, | 400 }, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 392 | 429 |
| 393 passphraseInput.invalid = emptyPassphrase; | 430 passphraseInput.invalid = emptyPassphrase; |
| 394 passphraseConfirmationInput.invalid = | 431 passphraseConfirmationInput.invalid = |
| 395 !emptyPassphrase && mismatchedPassphrase; | 432 !emptyPassphrase && mismatchedPassphrase; |
| 396 | 433 |
| 397 return !emptyPassphrase && !mismatchedPassphrase; | 434 return !emptyPassphrase && !mismatchedPassphrase; |
| 398 }, | 435 }, |
| 399 }); | 436 }); |
| 400 | 437 |
| 401 })(); | 438 })(); |
| OLD | NEW |