Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6067)

Unified Diff: chrome/browser/sync/backend_migrator.h

Issue 10167017: Fix some migration-related bugs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/backend_migrator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/backend_migrator.h
diff --git a/chrome/browser/sync/backend_migrator.h b/chrome/browser/sync/backend_migrator.h
index 4688ce63d72dddb65f35826f8aade9170b16981f..d40ddbb16f883810de6a36e8b66f0f92a30abfcd 100644
--- a/chrome/browser/sync/backend_migrator.h
+++ b/chrome/browser/sync/backend_migrator.h
@@ -33,7 +33,7 @@ class MigrationObserver {
// A class to perform migration of a datatype pursuant to the 'MIGRATION_DONE'
// code in the sync protocol definition (protocol/sync.proto).
-class BackendMigrator : public content::NotificationObserver {
+class BackendMigrator {
public:
enum State {
IDLE,
@@ -50,7 +50,8 @@ class BackendMigrator : public content::NotificationObserver {
BackendMigrator(const std::string& name,
sync_api::UserShare* user_share,
ProfileSyncService* service,
- DataTypeManager* manager);
+ DataTypeManager* manager,
+ const base::Closure &migration_done_callback);
virtual ~BackendMigrator();
// Starts a sequence of events that will disable and reenable |types|.
@@ -60,13 +61,12 @@ class BackendMigrator : public content::NotificationObserver {
bool HasMigrationObserver(MigrationObserver* observer) const;
void RemoveMigrationObserver(MigrationObserver* observer);
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
State state() const;
+ // Called from ProfileSyncService to notify us of configure done.
+ // Note: We receive these notificiations only when our state is not IDLE.
+ void OnConfigureDone(const DataTypeManager::ConfigureResult& result);
+
// Returns the types that are currently pending migration (if any).
syncable::ModelTypeSet GetPendingMigrationTypesForTest() const;
@@ -82,8 +82,8 @@ class BackendMigrator : public content::NotificationObserver {
// Restarts migration, interrupting any existing migration.
void RestartMigration();
- // Called by Observe().
- void OnConfigureDone(const DataTypeManager::ConfigureResult& result);
+ // Called by OnConfigureDone().
+ void OnConfigureDoneImpl(const DataTypeManager::ConfigureResult& result);
const std::string name_;
sync_api::UserShare* user_share_;
@@ -92,14 +92,14 @@ class BackendMigrator : public content::NotificationObserver {
State state_;
- content::NotificationRegistrar registrar_;
-
ObserverList<MigrationObserver> migration_observers_;
syncable::ModelTypeSet to_migrate_;
base::WeakPtrFactory<BackendMigrator> weak_ptr_factory_;
+ base::Closure migration_done_callback_;
+
DISALLOW_COPY_AND_ASSIGN(BackendMigrator);
};
« no previous file with comments | « no previous file | chrome/browser/sync/backend_migrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698