diff options
Diffstat (limited to 'chrome/browser/sync/profile_sync_service.cc')
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index cefb143..3e42b20 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -433,11 +433,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() { @@ -756,6 +752,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) { if (!cros_user_.empty()) { // For ChromeOS, any login UI needs to be handled by the settings page. @@ -1066,6 +1070,14 @@ void ProfileSyncService::ConfigureDataTypeManager() { syncable::ModelTypeSet types; GetPreferredDataTypes(&types); + // We set this special case here since it's the only datatype whose encryption + // status we already know. All others are set after the initial sync + // completes (for now). + // TODO(zea): Implement a better way that uses preferences for which types + // need encryption. + encrypted_types_.clear(); + if (types.count(syncable::PASSWORDS) > 0) + encrypted_types_.insert(syncable::PASSWORDS); data_type_manager_->Configure(types); } @@ -1178,6 +1190,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) { |