summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/profile_sync_service.h
diff options
context:
space:
mode:
authorskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 00:42:55 +0000
committerskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 00:42:55 +0000
commit5342662c41d6a3e06eb91a3e6e9c3fbd28728886 (patch)
tree274416b556c1f88b286a17609a89569583905dac /chrome/browser/sync/profile_sync_service.h
parentfe8fa4c54238b86c22940e7fd672b4b44846083c (diff)
downloadchromium_src-5342662c41d6a3e06eb91a3e6e9c3fbd28728886.zip
chromium_src-5342662c41d6a3e06eb91a3e6e9c3fbd28728886.tar.gz
chromium_src-5342662c41d6a3e06eb91a3e6e9c3fbd28728886.tar.bz2
Move data type start/stop management into DataTypeManager
This change introduces a new interface/class called DataTypeManager whose job is to choreograph the start up and shut down of all registered data types. It starts each data type serially, waiting for each data type to finish starting before starting the next one. If anything goes wrong on startup, all data types are stopped. Note that this change also simplifies the ProfileSyncServiceStartupTest as many of the cases it tested for are now the responsibility of the DataTypeManagerImpl (and these are thoroughly tested in its unit test). I also killed off the TestProfileSyncFactory in the ProfileSyncServiceTest since it was lame and could be done with the mock. BUG=36506 Review URL: http://codereview.chromium.org/650175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_service.h')
-rw-r--r--chrome/browser/sync/profile_sync_service.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index ce36f98..109e814 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -15,6 +15,7 @@
#include "chrome/browser/google_service_auth_error.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
+#include "chrome/browser/sync/glue/data_type_manager.h"
#include "chrome/browser/sync/glue/sync_backend_host.h"
#include "chrome/browser/sync/notification_method.h"
#include "chrome/browser/sync/sync_setup_wizard.h"
@@ -22,6 +23,8 @@
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
+class ProfileSyncFactory;
+
namespace browser_sync {
class ChangeProcessor;
@@ -86,7 +89,9 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
MAX_SYNC_EVENT_CODE
};
- ProfileSyncService(Profile* profile, bool bootstrap_sync_authentication);
+ ProfileSyncService(ProfileSyncFactory* factory_,
+ Profile* profile,
+ bool bootstrap_sync_authentication);
virtual ~ProfileSyncService();
// Initializes the object. This should be called every time an object of this
@@ -236,10 +241,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
void RegisterPreferences();
void ClearPreferences();
- void BookmarkStartCallback(
- browser_sync::DataTypeController::StartResult result);
- void PreferenceStartCallback(
- browser_sync::DataTypeController::StartResult result);
+ void DataTypeManagerStartCallback(
+ browser_sync::DataTypeManager::StartResult result);
// Tests need to override this. If |delete_sync_data_folder| is true, then
// this method will delete all previous "Sync Data" folders. (useful if the
@@ -271,15 +274,15 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// store to bootstrap the authentication process.
virtual std::string GetLsidForAuthBootstraping();
- // Stops a data type.
- void StopDataType(syncable::ModelType model_type);
-
// Time at which we begin an attempt a GAIA authorization.
base::TimeTicks auth_start_time_;
// Time at which error UI is presented for the new tab page.
base::TimeTicks auth_error_time_;
+ // Factory used to create various dependent objects.
+ ProfileSyncFactory* factory_;
+
// The profile whose data we are synchronizing.
Profile* profile_;
@@ -339,6 +342,9 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// Which peer-to-peer notification method to use.
browser_sync::NotificationMethod notification_method_;
+ // Manages the start and stop of the various data types.
+ scoped_ptr<browser_sync::DataTypeManager> data_type_manager_;
+
ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);