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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 665223007: Add a flag to ProfileSyncService that says whether encrypting all data is allowed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 72f7999c8bacbf526b7f512b0cb0b5e6c9a7b969..70d323d05c98267fb03f9e5a4038af24e2cda484 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -218,6 +218,7 @@ ProfileSyncService::ProfileSyncService(
unrecoverable_error_reason_(ERROR_REASON_UNSET),
expect_sync_configuration_aborted_(false),
encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()),
+ encrypt_everything_allowed_(true),
encrypt_everything_(false),
encryption_pending_(false),
configure_status_(DataTypeManager::UNKNOWN),
@@ -1362,6 +1363,7 @@ void ProfileSyncService::OnEncryptedTypesChanged(
bool encrypt_everything) {
encrypted_types_ = encrypted_types;
encrypt_everything_ = encrypt_everything;
+ DCHECK(encrypt_everything_allowed_ || !encrypt_everything_);
DVLOG(1) << "Encrypted types changed to "
<< syncer::ModelTypeSetToString(encrypted_types_)
<< " (encrypt everything is set to "
@@ -2194,7 +2196,18 @@ bool ProfileSyncService::SetDecryptionPassphrase(
}
}
+bool ProfileSyncService::EncryptEverythingAllowed() const {
+ return encrypt_everything_allowed_;
+}
+
+void ProfileSyncService::SetEncryptEverythingAllowed(bool allowed) {
+ DCHECK(allowed || !backend_initialized() || !EncryptEverythingEnabled());
+ encrypt_everything_allowed_ = allowed;
+}
+
void ProfileSyncService::EnableEncryptEverything() {
+ DCHECK(EncryptEverythingAllowed());
+
// Tests override backend_initialized() to always return true, so we
// must check that instead of |backend_initialized_|.
// TODO(akalin): Fix the above. :/
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698