diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 19:18:53 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 19:18:53 +0000 |
commit | 210007c4ad5225b2b5ca56ee3f009167c9705ac0 (patch) | |
tree | 80c4f0a2376914ec49cffb964408e1173cffd144 /chrome/browser/sync/profile_sync_service.h | |
parent | b3300dc30deee1992729a78bc5c053c7a136d6a7 (diff) | |
download | chromium_src-210007c4ad5225b2b5ca56ee3f009167c9705ac0.zip chromium_src-210007c4ad5225b2b5ca56ee3f009167c9705ac0.tar.gz chromium_src-210007c4ad5225b2b5ca56ee3f009167c9705ac0.tar.bz2 |
Generic ModelAssociator based on prototype from earlier CL.
BUG=29831
TEST=ProfileSyncServiceTest
Review URL: http://codereview.chromium.org/507039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_service.h')
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 7a0dab08..794831b 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -229,8 +229,24 @@ class ProfileSyncService : public NotificationObserver, // Tests need to override this. virtual void InitializeBackend(); - // Tests need this. - void set_change_processor(browser_sync::ChangeProcessor* change_processor); + template <class AssociatorImpl, class ChangeProcessorImpl> + void InstallGlue() { + model_associator_->CreateAndRegisterPerDataTypeImpl<AssociatorImpl>(); + // TODO(tim): Keep a map instead of a set so we can register/unregister + // data type specific ChangeProcessors, once we have more than one. + STLDeleteElements(processors()); + ChangeProcessorImpl* processor = new ChangeProcessorImpl(this); + change_processors_.insert(processor); + processor->set_model_associator( + model_associator_->GetImpl<AssociatorImpl>()); + } + + browser_sync::ModelAssociator* associator() { + return model_associator_.get(); + } + std::set<browser_sync::ChangeProcessor*>* processors() { + return &change_processors_; + } // We keep track of the last auth error observed so we can cover up the first // "expected" auth failure from observers. @@ -281,6 +297,9 @@ class ProfileSyncService : public NotificationObserver, // other threads. scoped_ptr<browser_sync::SyncBackendHost> backend_; + // Model association manager instance. + scoped_ptr<browser_sync::ModelAssociator> model_associator_; + // The change processors that handle the different data types. std::set<browser_sync::ChangeProcessor*> change_processors_; |