Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: chrome/browser/resources/settings/people_page/sync_page.js

Issue 2068653003: Settings People Revamp: Add Payments integration to new Sync Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 }, 166 },
167 167
168 /** 168 /**
169 * Handler for when the sync preferences are updated. 169 * Handler for when the sync preferences are updated.
170 * @private 170 * @private
171 */ 171 */
172 handleSyncPrefsChanged_: function(syncPrefs) { 172 handleSyncPrefsChanged_: function(syncPrefs) {
173 this.syncPrefs = syncPrefs; 173 this.syncPrefs = syncPrefs;
174 this.selectedPage_ = settings.PageStatus.CONFIGURE; 174 this.selectedPage_ = settings.PageStatus.CONFIGURE;
175 175
176 // If autofill is not registered or synced, force payments integration off.
Justin Donnelly 2016/06/14 19:56:41 s/payments/Payments/
tommycli 2016/06/14 20:42:09 Done.
177 if (!this.syncPrefs.autofillRegistered || !this.syncPrefs.autofillSynced)
178 this.set('syncPrefs.paymentsIntegrationEnabled', false);
Justin Donnelly 2016/06/14 19:56:41 I think there may be an opportunity to fix https:/
tommycli 2016/06/14 20:42:09 Acknowledged. Deferred to a different patch / disc
179
176 // Hide the new passphrase box if the sync data has been encrypted. 180 // Hide the new passphrase box if the sync data has been encrypted.
177 if (this.syncPrefs.encryptAllData) 181 if (this.syncPrefs.encryptAllData)
178 this.creatingNewPassphrase_ = false; 182 this.creatingNewPassphrase_ = false;
179 }, 183 },
180 184
181 /** 185 /**
182 * Handler for when the sync all data types checkbox is changed. 186 * Handler for when the sync all data types checkbox is changed.
183 * @param {Event} event 187 * @param {Event} event
184 * @private 188 * @private
185 */ 189 */
186 onSyncAllDataTypesChanged_: function(event) { 190 onSyncAllDataTypesChanged_: function(event) {
187 if (event.target.checked) { 191 if (event.target.checked) {
188 this.set('syncPrefs.syncAllDataTypes', true); 192 this.set('syncPrefs.syncAllDataTypes', true);
189 this.set('syncPrefs.appsSynced', true); 193 this.set('syncPrefs.appsSynced', true);
190 this.set('syncPrefs.extensionsSynced', true); 194 this.set('syncPrefs.extensionsSynced', true);
191 this.set('syncPrefs.preferencesSynced', true); 195 this.set('syncPrefs.preferencesSynced', true);
192 this.set('syncPrefs.autofillSynced', true); 196 this.set('syncPrefs.autofillSynced', true);
193 this.set('syncPrefs.typedUrlsSynced', true); 197 this.set('syncPrefs.typedUrlsSynced', true);
194 this.set('syncPrefs.themesSynced', true); 198 this.set('syncPrefs.themesSynced', true);
195 this.set('syncPrefs.bookmarksSynced', true); 199 this.set('syncPrefs.bookmarksSynced', true);
196 this.set('syncPrefs.passwordsSynced', true); 200 this.set('syncPrefs.passwordsSynced', true);
197 this.set('syncPrefs.tabsSynced', true); 201 this.set('syncPrefs.tabsSynced', true);
202 this.set('syncPrefs.paymentsIntegrationEnabled', true);
198 } 203 }
199 204
200 this.onSingleSyncDataTypeChanged_(); 205 this.onSingleSyncDataTypeChanged_();
201 }, 206 },
202 207
203 /** 208 /**
204 * Handler for when any sync data type checkbox is changed. 209 * Handler for when any sync data type checkbox is changed (except autofill).
205 * @private 210 * @private
206 */ 211 */
207 onSingleSyncDataTypeChanged_: function() { 212 onSingleSyncDataTypeChanged_: function() {
208 this.browserProxy_.setSyncDatatypes(this.syncPrefs).then( 213 this.browserProxy_.setSyncDatatypes(this.syncPrefs).then(
209 this.handlePageStatusChanged_.bind(this)); 214 this.handlePageStatusChanged_.bind(this));
210 }, 215 },
211 216
212 /** 217 /**
218 * Handler for when the autofill data type checkbox is changed.
219 * @private
220 */
221 onAutofillDataTypeChanged_: function() {
222 this.set('syncPrefs.paymentsIntegrationEnabled',
223 this.syncPrefs.autofillSynced);
224
225 this.onSingleSyncDataTypeChanged_();
226 },
227
228 /**
213 * Sends the newly created custom sync passphrase to the browser. 229 * Sends the newly created custom sync passphrase to the browser.
214 * @private 230 * @private
215 */ 231 */
216 onSaveNewPassphraseTap_: function() { 232 onSaveNewPassphraseTap_: function() {
217 assert(this.creatingNewPassphrase_); 233 assert(this.creatingNewPassphrase_);
218 234
219 // If a new password has been entered but it is invalid, do not send the 235 // If a new password has been entered but it is invalid, do not send the
220 // sync state to the API. 236 // sync state to the API.
221 if (!this.validateCreatedPassphrases_()) 237 if (!this.validateCreatedPassphrases_())
222 return; 238 return;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 /** 324 /**
309 * @param {boolean} syncAllDataTypes 325 * @param {boolean} syncAllDataTypes
310 * @param {boolean} enforced 326 * @param {boolean} enforced
311 * @return {boolean} Whether the sync checkbox should be disabled. 327 * @return {boolean} Whether the sync checkbox should be disabled.
312 */ 328 */
313 shouldSyncCheckboxBeDisabled_: function(syncAllDataTypes, enforced) { 329 shouldSyncCheckboxBeDisabled_: function(syncAllDataTypes, enforced) {
314 return syncAllDataTypes || enforced; 330 return syncAllDataTypes || enforced;
315 }, 331 },
316 332
317 /** 333 /**
334 * @param {boolean} syncAllDataTypes
335 * @param {boolean} autofillSynced
336 * @return {boolean} Whether the sync checkbox should be disabled.
337 */
338 shouldWalletCheckboxBeDisabled_: function(syncAllDataTypes, autofillSynced) {
339 return syncAllDataTypes || !autofillSynced;
340 },
341
342 /**
318 * Checks the supplied passphrases to ensure that they are not empty and that 343 * Checks the supplied passphrases to ensure that they are not empty and that
319 * they match each other. Additionally, displays error UI if they are 344 * they match each other. Additionally, displays error UI if they are
320 * invalid. 345 * invalid.
321 * @return {boolean} Whether the check was successful (i.e., that the 346 * @return {boolean} Whether the check was successful (i.e., that the
322 * passphrases were valid). 347 * passphrases were valid).
323 * @private 348 * @private
324 */ 349 */
325 validateCreatedPassphrases_: function() { 350 validateCreatedPassphrases_: function() {
326 var passphraseInput = this.$$('#passphraseInput'); 351 var passphraseInput = this.$$('#passphraseInput');
327 var passphraseConfirmationInput = this.$$('#passphraseConfirmationInput'); 352 var passphraseConfirmationInput = this.$$('#passphraseConfirmationInput');
328 353
329 var passphrase = passphraseInput.value; 354 var passphrase = passphraseInput.value;
330 var confirmation = passphraseConfirmationInput.value; 355 var confirmation = passphraseConfirmationInput.value;
331 356
332 var emptyPassphrase = !passphrase; 357 var emptyPassphrase = !passphrase;
333 var mismatchedPassphrase = passphrase != confirmation; 358 var mismatchedPassphrase = passphrase != confirmation;
334 359
335 passphraseInput.invalid = emptyPassphrase; 360 passphraseInput.invalid = emptyPassphrase;
336 passphraseConfirmationInput.invalid = 361 passphraseConfirmationInput.invalid =
337 !emptyPassphrase && mismatchedPassphrase; 362 !emptyPassphrase && mismatchedPassphrase;
338 363
339 return !emptyPassphrase && !mismatchedPassphrase; 364 return !emptyPassphrase && !mismatchedPassphrase;
340 }, 365 },
341 }); 366 });
342 367
343 })(); 368 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698