| 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 their encryption | 8 * Names of the radio buttons which allow the user to choose their encryption |
| 9 * mechanism. | 9 * mechanism. |
| 10 * @enum {string} | 10 * @enum {string} |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 * Handler for when the sync all data types checkbox is changed. | 231 * Handler for when the sync all data types checkbox is changed. |
| 232 * @param {!Event} event | 232 * @param {!Event} event |
| 233 * @private | 233 * @private |
| 234 */ | 234 */ |
| 235 onSyncAllDataTypesChanged_: function(event) { | 235 onSyncAllDataTypesChanged_: function(event) { |
| 236 if (event.target.checked) { | 236 if (event.target.checked) { |
| 237 this.set('syncPrefs.syncAllDataTypes', true); | 237 this.set('syncPrefs.syncAllDataTypes', true); |
| 238 | 238 |
| 239 // Cache the previously selected preference before checking every box. | 239 // Cache the previously selected preference before checking every box. |
| 240 this.cachedSyncPrefs_ = {}; | 240 this.cachedSyncPrefs_ = {}; |
| 241 for (var dataType of SyncPrefsIndividualDataTypes) { | 241 for (var i = 0; i < SyncPrefsIndividualDataTypes.length; i++) { |
| 242 var dataType = SyncPrefsIndividualDataTypes[i]; |
| 242 // These are all booleans, so this shallow copy is sufficient. | 243 // These are all booleans, so this shallow copy is sufficient. |
| 243 this.cachedSyncPrefs_[dataType] = this.syncPrefs[dataType]; | 244 this.cachedSyncPrefs_[dataType] = this.syncPrefs[dataType]; |
| 244 | 245 |
| 245 this.set(['syncPrefs', dataType], true); | 246 this.set(['syncPrefs', dataType], true); |
| 246 } | 247 } |
| 247 } else if (this.cachedSyncPrefs_) { | 248 } else if (this.cachedSyncPrefs_) { |
| 248 // Restore the previously selected preference. | 249 // Restore the previously selected preference. |
| 249 for (dataType of SyncPrefsIndividualDataTypes) { | 250 for (var i = 0; i < SyncPrefsIndividualDataTypes.length; i++) { |
| 251 var dataType = SyncPrefsIndividualDataTypes[i]; |
| 250 this.set(['syncPrefs', dataType], this.cachedSyncPrefs_[dataType]); | 252 this.set(['syncPrefs', dataType], this.cachedSyncPrefs_[dataType]); |
| 251 } | 253 } |
| 252 } | 254 } |
| 253 | 255 |
| 254 this.onSingleSyncDataTypeChanged_(); | 256 this.onSingleSyncDataTypeChanged_(); |
| 255 }, | 257 }, |
| 256 | 258 |
| 257 /** | 259 /** |
| 258 * Handler for when any sync data type checkbox is changed (except autofill). | 260 * Handler for when any sync data type checkbox is changed (except autofill). |
| 259 * @private | 261 * @private |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 onLearnMoreTap_: function(event) { | 429 onLearnMoreTap_: function(event) { |
| 428 if (event.target.tagName == 'A') { | 430 if (event.target.tagName == 'A') { |
| 429 // Stop the propagation of events, so that clicking on links inside | 431 // Stop the propagation of events, so that clicking on links inside |
| 430 // checkboxes or radio buttons won't change the value. | 432 // checkboxes or radio buttons won't change the value. |
| 431 event.stopPropagation(); | 433 event.stopPropagation(); |
| 432 } | 434 } |
| 433 } | 435 } |
| 434 }); | 436 }); |
| 435 | 437 |
| 436 })(); | 438 })(); |
| OLD | NEW |