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

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

Issue 2828021: Take 2: sync changes to support encryption (Closed)
Patch Set: fix flaky password test under valgrind Created 10 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 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 7e53ba14b71a5bf47659757dd527b7a38cc96364..7b4f3fb526adc9f997636b64a340a8ac2f207b57 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/browser/sync/glue/data_type_manager.h"
#include "chrome/browser/sync/profile_sync_factory.h"
+#include "chrome/browser/sync/syncable/directory_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
@@ -78,6 +79,12 @@ ProfileSyncService::ProfileSyncService(
registrar_.Add(this,
NotificationType::SYNC_CONFIGURE_DONE,
NotificationService::AllSources());
+ registrar_.Add(this,
+ NotificationType::SYNC_PASSPHRASE_REQUIRED,
+ NotificationService::AllSources());
+ registrar_.Add(this,
+ NotificationType::SYNC_PASSPHRASE_ACCEPTED,
+ NotificationService::AllSources());
// By default, dev & chromium users will go to the development servers.
// Dev servers have more features than standard sync servers.
@@ -650,8 +657,12 @@ void ProfileSyncService::GetRegisteredDataTypes(
}
bool ProfileSyncService::IsCryptographerReady() const {
- // TODO(albertb): Replace this once the crypto patch lands.
- return true;
+ return backend_->GetUserShareHandle()->
+ dir_manager->cryptographer()->is_ready();
+}
+
+void ProfileSyncService::SetPassphrase(const std::string& passphrase) {
+ backend_->SetPassphrase(passphrase);
}
void ProfileSyncService::StartProcessingChangesIfReady() {
@@ -710,6 +721,21 @@ void ProfileSyncService::Observe(NotificationType type,
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
break;
}
+ case NotificationType::SYNC_PASSPHRASE_REQUIRED: {
+ // TODO(sync): Show the passphrase UI here.
+ SetPassphrase("dummy passphrase");
+ break;
+ }
+ case NotificationType::SYNC_PASSPHRASE_ACCEPTED: {
+ // Make sure the data types that depend on the passphrase are started at
+ // this time.
+ syncable::ModelTypeSet types;
+ GetPreferredDataTypes(&types);
+ data_type_manager_->Configure(types);
+
+ FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
+ break;
+ }
default: {
NOTREACHED();
}
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_password_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698