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

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

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Rest of unit tests. Created 9 years, 10 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
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 bb255856cd163115108dca826f726b8b5ef0d03b..1d9b7da648c626a08cb415c5ac8e6148e0ebbd1a 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -432,11 +432,7 @@ void ProfileSyncService::CreateBackend() {
}
bool ProfileSyncService::IsEncryptedDatatypeEnabled() const {
- // Currently on passwords are an encrypted datatype, so
- // we check to see if it is enabled.
- syncable::ModelTypeSet types;
- GetPreferredDataTypes(&types);
- return types.count(syncable::PASSWORDS) != 0;
+ return encrypted_types_.size() > 0;
}
void ProfileSyncService::StartUp() {
@@ -748,6 +744,14 @@ void ProfileSyncService::OnPassphraseAccepted() {
wizard_.Step(SyncSetupWizard::DONE);
}
+void ProfileSyncService::OnEncryptionComplete(
+ const syncable::ModelTypeSet& encrypted_types) {
+ if (encrypted_types_ != encrypted_types) {
+ encrypted_types_ = encrypted_types;
+ NotifyObservers();
+ }
+}
+
void ProfileSyncService::ShowLoginDialog(gfx::NativeWindow parent_window) {
// TODO(johnnyg): File a bug to make sure this doesn't happen.
if (!cros_user_.empty()) {
@@ -1165,6 +1169,16 @@ void ProfileSyncService::SetPassphrase(const std::string& passphrase,
tried_setting_explicit_passphrase_ = true;
}
+void ProfileSyncService::EncryptDataTypes(
+ const syncable::ModelTypeSet& encrypted_types) {
+ backend_->EncryptDataTypes(encrypted_types);
+}
+
+void ProfileSyncService::GetEncryptedDataTypes(
+ syncable::ModelTypeSet* encrypted_types) const {
+ *encrypted_types = encrypted_types_;
+}
+
void ProfileSyncService::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698