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(); |
} |