Chromium Code Reviews| Index: chrome/browser/sync/glue/sync_backend_registrar.cc |
| diff --git a/chrome/browser/sync/glue/sync_backend_registrar.cc b/chrome/browser/sync/glue/sync_backend_registrar.cc |
| index 441774654bb983c3cb9edb801b5ef6b05f8b94e4..6d85c9ac1a983805b90f3282ebbae59c4e4d5d5f 100644 |
| --- a/chrome/browser/sync/glue/sync_backend_registrar.cc |
| +++ b/chrome/browser/sync/glue/sync_backend_registrar.cc |
| @@ -53,7 +53,6 @@ bool IsOnThreadForGroup(ModelSafeGroup group) { |
| } // namespace |
| SyncBackendRegistrar::SyncBackendRegistrar( |
| - syncable::ModelTypeSet initial_types, |
| const std::string& name, Profile* profile, |
| MessageLoop* sync_loop) : |
| name_(name), |
| @@ -69,33 +68,16 @@ SyncBackendRegistrar::SyncBackendRegistrar( |
| workers_[GROUP_UI] = ui_worker_; |
| workers_[GROUP_PASSIVE] = new PassiveModelWorker(sync_loop_); |
| - // Any datatypes that we want the syncer to pull down must be in the |
| - // routing_info map. We set them to group passive, meaning that |
| - // updates will be applied to sync, but not dispatched to the native |
| - // models. |
| - for (syncable::ModelTypeSet::Iterator it = initial_types.First(); |
| - it.Good(); it.Inc()) { |
| - routing_info_[it.Get()] = GROUP_PASSIVE; |
| - } |
| - |
| HistoryService* history_service = profile->GetHistoryService( |
| Profile::IMPLICIT_ACCESS); |
| if (history_service) { |
| workers_[GROUP_HISTORY] = new HistoryModelWorker(history_service); |
| - } else { |
| - LOG_IF(WARNING, initial_types.Has(syncable::TYPED_URLS)) |
| - << "History store disabled, cannot sync Omnibox History"; |
| - routing_info_.erase(syncable::TYPED_URLS); |
| } |
| scoped_refptr<PasswordStore> password_store = |
| PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
| if (password_store.get()) { |
| workers_[GROUP_PASSWORD] = new PasswordModelWorker(password_store); |
| - } else { |
| - LOG_IF(WARNING, initial_types.Has(syncable::PASSWORDS)) |
| - << "Password store not initialized, cannot sync passwords"; |
| - routing_info_.erase(syncable::PASSWORDS); |
| } |
| } |
| @@ -104,6 +86,29 @@ SyncBackendRegistrar::~SyncBackendRegistrar() { |
| DCHECK(stopped_on_ui_thread_); |
| } |
| +void SyncBackendRegistrar::SetInitialTypes( |
| + syncable::ModelTypeSet initial_types) { |
| + // Set our initial state to reflect the current status of the sync directory. |
|
rlarocque
2012/06/04 20:07:09
I could use a flag and some DCHECKs to ensure that
|
| + // This will ensure that our calculations in ConfigureDataTypes() will always |
| + // return correct results. |
| + for (syncable::ModelTypeSet::Iterator it = initial_types.First(); |
| + it.Good(); it.Inc()) { |
| + routing_info_[it.Get()] = GROUP_PASSIVE; |
| + } |
| + |
| + if (!workers_.count(GROUP_HISTORY)) { |
| + LOG_IF(WARNING, initial_types.Has(syncable::TYPED_URLS)) |
| + << "History store disabled, cannot sync Omnibox History"; |
| + routing_info_.erase(syncable::TYPED_URLS); |
| + } |
| + |
| + if (!workers_.count(GROUP_PASSWORD)) { |
| + LOG_IF(WARNING, initial_types.Has(syncable::PASSWORDS)) |
| + << "Password store not initialized, cannot sync passwords"; |
| + routing_info_.erase(syncable::PASSWORDS); |
| + } |
| +} |
| + |
| bool SyncBackendRegistrar::IsNigoriEnabled() const { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| base::AutoLock lock(lock_); |