From 210007c4ad5225b2b5ca56ee3f009167c9705ac0 Mon Sep 17 00:00:00 2001 From: "tim@chromium.org" Date: Thu, 17 Dec 2009 19:18:53 +0000 Subject: 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 --- chrome/browser/sync/profile_sync_service.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'chrome/browser/sync/profile_sync_service.h') 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 + void InstallGlue() { + model_associator_->CreateAndRegisterPerDataTypeImpl(); + // 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()); + } + + browser_sync::ModelAssociator* associator() { + return model_associator_.get(); + } + std::set* 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 backend_; + // Model association manager instance. + scoped_ptr model_associator_; + // The change processors that handle the different data types. std::set change_processors_; -- cgit v1.1