Index: chrome/browser/resources/options/sync_setup_overlay.js |
diff --git a/chrome/browser/resources/options/sync_setup_overlay.js b/chrome/browser/resources/options/sync_setup_overlay.js |
index d3ba46b62f587e1f5f83969be35ffc4b73bb31e3..4b21d4071d6446fd8d95c2b2d9f58cfe0924846a 100644 |
--- a/chrome/browser/resources/options/sync_setup_overlay.js |
+++ b/chrome/browser/resources/options/sync_setup_overlay.js |
@@ -63,7 +63,7 @@ cr.define('options', function() { |
return false; |
}; |
$('google-option').onchange = $('explicit-option').onchange = function() { |
- self.onRadioChange_(); |
+ self.onPassphraseRadioChanged_(); |
}; |
$('choose-datatypes-cancel').onclick = $('sync-setup-cancel').onclick = |
$('confirm-everything-cancel').onclick = function() { |
@@ -123,7 +123,18 @@ cr.define('options', function() { |
chrome.send("Passphrase", [result]); |
}, |
- getRadioCheckedValue_: function() { |
+ getEncryptionRadioCheckedValue_: function() { |
+ var f = $('choose-data-types-form'); |
+ for (var i = 0; i < f.encrypt.length; ++i) { |
+ if (f.encrypt[i].checked) { |
+ return f.encrypt[i].value; |
+ } |
+ } |
+ |
+ return undefined; |
+ }, |
+ |
+ getPassphraseRadioCheckedValue_: function() { |
var f = $('choose-data-types-form'); |
for (var i = 0; i < f.option.length; ++i) { |
if (f.option[i].checked) { |
@@ -134,8 +145,14 @@ cr.define('options', function() { |
return undefined; |
}, |
- onRadioChange_: function() { |
- var visible = this.getRadioCheckedValue_() == "explicit"; |
+ disableEncryptionRadioGroup_: function() { |
+ var f = $('choose-data-types-form'); |
+ for (var i = 0; i < f.encrypt.length; ++i) |
+ f.encrypt[i].disabled = true; |
+ }, |
+ |
+ onPassphraseRadioChanged_: function() { |
+ var visible = this.getPassphraseRadioCheckedValue_() == "explicit"; |
$('sync-custom-passphrase').hidden = !visible; |
}, |
@@ -196,7 +213,8 @@ cr.define('options', function() { |
mismatchError.style.display = "none"; |
var f = $('choose-data-types-form'); |
- if (this.getRadioCheckedValue_() != "explicit" || f.option[0].disabled) |
+ if (this.getPassphraseRadioCheckedValue_() != "explicit" || |
+ f.option[0].disabled) |
return true; |
var customPassphrase = $('custom-passphrase'); |
@@ -240,6 +258,8 @@ cr.define('options', function() { |
var syncAll = |
document.getElementById('sync-select-datatypes').selectedIndex == 0; |
+ var usePassphrase = this.getPassphraseRadioCheckedValue_() == 'explicit'; |
+ var encryptAllData = this.getEncryptionRadioCheckedValue_() == 'all'; |
// These values need to be kept in sync with where they are read in |
// SyncSetupFlow::GetDataTypeChoiceData(). |
@@ -254,7 +274,8 @@ cr.define('options', function() { |
"syncTypedUrls": syncAll || $('typed-urls-checkbox').checked, |
"syncApps": syncAll || $('apps-checkbox').checked, |
"syncSessions": syncAll || $('sessions-checkbox').checked, |
- "usePassphrase": (this.getRadioCheckedValue_() == 'explicit'), |
+ "encryptAllData": encryptAllData, |
+ "usePassphrase": usePassphrase, |
"passphrase": $('custom-passphrase').value |
}); |
chrome.send("Configure", [result]); |
@@ -327,8 +348,17 @@ cr.define('options', function() { |
} |
}, |
- setEncryptionCheckboxes_: function(args) { |
- if (args["usePassphrase"]) { |
+ setEncryptionRadios_: function(args) { |
+ if (args['encryptAllData']) { |
+ $('encrypt-all-option').checked = true; |
+ this.disableEncryptionRadioGroup_(); |
+ } else { |
+ $('encrypt-sensitive-option').checked = true; |
+ } |
+ }, |
+ |
+ setPassphraseRadios_: function(args) { |
+ if (args['usePassphrase']) { |
$('explicit-option').checked = true; |
// The passphrase, once set, cannot be unset, but we show a reset link. |
@@ -350,7 +380,8 @@ cr.define('options', function() { |
setCheckboxesAndErrors_: function(args) { |
this.setChooseDataTypesCheckboxes_(args); |
- this.setEncryptionCheckboxes_(args); |
+ this.setEncryptionRadios_(args); |
+ this.setPassphraseRadios_(args); |
this.setErrorState_(args); |
}, |
@@ -366,6 +397,8 @@ cr.define('options', function() { |
$('sync-setup-configure').classList.remove('hidden'); |
if (args) { |
+ if (!args['encryptionEnabled']) |
+ $('customize-sync-encryption').classList.add('hidden'); |
this.setCheckboxesAndErrors_(args); |
// Whether to display the 'Sync everything' confirmation page or the |