| 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 493593c1c5581d258bdead150a24890a8096c086..6e7cf4bcd6bfefa38f4873f42e406c55a0c4c330 100644
|
| --- a/chrome/browser/sync/glue/sync_backend_host.cc
|
| +++ b/chrome/browser/sync/glue/sync_backend_host.cc
|
| @@ -30,6 +30,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"
|
| @@ -125,17 +126,13 @@ void SyncBackendHost::Initialize(
|
| registrar_.workers[GROUP_PASSWORD] =
|
| new PasswordModelWorker(password_store);
|
| } else {
|
| - LOG(WARNING) << "Password store not initialized, cannot sync passwords";
|
| + LOG_IF(WARNING, types.count(syncable::PASSWORDS) > 0) << "Password store "
|
| + << "not initialized, cannot sync passwords";
|
| registrar_.routing_info.erase(syncable::PASSWORDS);
|
| }
|
|
|
| - // 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,
|
| @@ -407,6 +404,14 @@ void SyncBackendHost::ConfigureDataTypes(
|
| }
|
| }
|
|
|
| +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));
|
| @@ -511,6 +516,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,
|
| @@ -669,6 +682,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)
|
| @@ -888,6 +907,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::RouteJsEvent(
|
| const std::string& name, const JsArgList& args,
|
| const JsEventHandler* target) {
|
|
|