| Index: chrome/browser/sync/glue/sync_backend_host.cc
|
| diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
|
| index 9b154fdc23b718815dedb16d03d3914077466a4e..35548fbfdb758fce99f625516959e4cef0326c80 100644
|
| --- a/chrome/browser/sync/glue/sync_backend_host.cc
|
| +++ b/chrome/browser/sync/glue/sync_backend_host.cc
|
| @@ -29,6 +29,7 @@
|
| // TODO(tim): Remove this! We should have a syncapi pass-thru instead.
|
| #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer.
|
| #include "chrome/browser/sync/syncable/model_type.h"
|
| +#include "chrome/browser/sync/syncable/nigori_util.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/chrome_version_info.h"
|
| #include "chrome/common/net/gaia/gaia_constants.h"
|
| @@ -127,13 +128,8 @@ void SyncBackendHost::Initialize(
|
| registrar_.routing_info[(*it)] = GROUP_PASSIVE;
|
| }
|
|
|
| - // TODO(tim): Remove this special case once NIGORI is populated by
|
| - // default. We piggy back off of the passwords flag for now to not
|
| - // require both encryption and passwords flags.
|
| - bool enable_encryption = !CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kDisableSyncPasswords) || types.count(syncable::PASSWORDS);
|
| - if (enable_encryption)
|
| - registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
|
| + // Nigori is populated by default now.
|
| + registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
|
|
|
| InitCore(Core::DoInitializeOptions(
|
| sync_service_url,
|
| @@ -387,6 +383,14 @@ void SyncBackendHost::ConfigureDataTypes(
|
| RequestNudge();
|
| }
|
|
|
| +void SyncBackendHost::EncryptDataTypes(
|
| + const syncable::ModelTypeSet& encrypted_types) {
|
| + core_thread_.message_loop()->PostTask(FROM_HERE,
|
| + NewRunnableMethod(core_.get(),
|
| + &SyncBackendHost::Core::DoEncryptDataTypes,
|
| + encrypted_types));
|
| +}
|
| +
|
| void SyncBackendHost::RequestNudge() {
|
| core_thread_.message_loop()->PostTask(FROM_HERE,
|
| NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestNudge));
|
| @@ -491,6 +495,14 @@ void SyncBackendHost::Core::NotifyUpdatedToken(const std::string& token) {
|
| Details<const TokenAvailableDetails>(&details));
|
| }
|
|
|
| +void SyncBackendHost::Core::NotifyEncryptionComplete(
|
| + const syncable::ModelTypeSet& encrypted_types) {
|
| + if (!host_)
|
| + return;
|
| + DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_);
|
| + host_->frontend_->OnEncryptionComplete(encrypted_types);
|
| +}
|
| +
|
| SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions(
|
| const GURL& service_url,
|
| sync_api::HttpPostProviderFactory* http_bridge_factory,
|
| @@ -641,6 +653,12 @@ void SyncBackendHost::Core::DoSetPassphrase(const std::string& passphrase,
|
| syncapi_->SetPassphrase(passphrase, is_explicit);
|
| }
|
|
|
| +void SyncBackendHost::Core::DoEncryptDataTypes(
|
| + const syncable::ModelTypeSet& encrypted_types) {
|
| + DCHECK(MessageLoop::current() == host_->core_thread_.message_loop());
|
| + syncapi_->EncryptDataTypes(encrypted_types);
|
| +}
|
| +
|
| UIModelWorker* SyncBackendHost::ui_worker() {
|
| ModelSafeWorker* w = registrar_.workers[GROUP_UI];
|
| if (w == NULL)
|
| @@ -860,6 +878,14 @@ void SyncBackendHost::Core::OnClearServerDataFailed() {
|
| &Core::HandleClearServerDataFailedOnFrontendLoop));
|
| }
|
|
|
| +void SyncBackendHost::Core::OnEncryptionComplete(
|
| + const syncable::ModelTypeSet& encrypted_types) {
|
| + host_->frontend_loop_->PostTask(
|
| + FROM_HERE,
|
| + NewRunnableMethod(this, &Core::NotifyEncryptionComplete,
|
| + encrypted_types));
|
| +}
|
| +
|
| void SyncBackendHost::Core::HandleStopSyncingPermanentlyOnFrontendLoop() {
|
| if (!host_ || !host_->frontend_)
|
| return;
|
|
|