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

Side by Side Diff: chrome/browser/sync/backend_migrator.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SYNC_BACKEND_MIGRATOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_BACKEND_MIGRATOR_H_
6 #define CHROME_BROWSER_SYNC_BACKEND_MIGRATOR_H_ 6 #define CHROME_BROWSER_SYNC_BACKEND_MIGRATOR_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "chrome/browser/sync/glue/data_type_manager.h" 11 #include "chrome/browser/sync/glue/data_type_manager.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 #include "sync/internal_api/public/syncable/model_type.h" 14 #include "sync/internal_api/public/syncable/model_type.h"
15 15
16 class ProfileSyncService; 16 class ProfileSyncService;
17 17
18 namespace csync { 18 namespace syncer {
19 struct UserShare; 19 struct UserShare;
20 } // namespace csync 20 } // namespace syncer
21 21
22 namespace browser_sync { 22 namespace browser_sync {
23 23
24 // Interface for anything that wants to know when the migrator's state 24 // Interface for anything that wants to know when the migrator's state
25 // changes. 25 // changes.
26 class MigrationObserver { 26 class MigrationObserver {
27 public: 27 public:
28 virtual void OnMigrationStateChange() = 0; 28 virtual void OnMigrationStateChange() = 0;
29 29
30 protected: 30 protected:
(...skipping 10 matching lines...) Expand all
41 DISABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for 41 DISABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for
42 // enabled types _excluding_ |to_migrate_| and 42 // enabled types _excluding_ |to_migrate_| and
43 // empty download progress markers for types 43 // empty download progress markers for types
44 // in |to_migrate_|. 44 // in |to_migrate_|.
45 REENABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for enabled 45 REENABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for enabled
46 // types. 46 // types.
47 }; 47 };
48 48
49 // TODO(akalin): Remove the dependency on |user_share|. 49 // TODO(akalin): Remove the dependency on |user_share|.
50 BackendMigrator(const std::string& name, 50 BackendMigrator(const std::string& name,
51 csync::UserShare* user_share, 51 syncer::UserShare* user_share,
52 ProfileSyncService* service, 52 ProfileSyncService* service,
53 DataTypeManager* manager, 53 DataTypeManager* manager,
54 const base::Closure &migration_done_callback); 54 const base::Closure &migration_done_callback);
55 virtual ~BackendMigrator(); 55 virtual ~BackendMigrator();
56 56
57 // Starts a sequence of events that will disable and reenable |types|. 57 // Starts a sequence of events that will disable and reenable |types|.
58 void MigrateTypes(syncable::ModelTypeSet types); 58 void MigrateTypes(syncable::ModelTypeSet types);
59 59
60 void AddMigrationObserver(MigrationObserver* observer); 60 void AddMigrationObserver(MigrationObserver* observer);
61 bool HasMigrationObserver(MigrationObserver* observer) const; 61 bool HasMigrationObserver(MigrationObserver* observer) const;
(...skipping 17 matching lines...) Expand all
79 // returns false. 79 // returns false.
80 bool TryStart(); 80 bool TryStart();
81 81
82 // Restarts migration, interrupting any existing migration. 82 // Restarts migration, interrupting any existing migration.
83 void RestartMigration(); 83 void RestartMigration();
84 84
85 // Called by OnConfigureDone(). 85 // Called by OnConfigureDone().
86 void OnConfigureDoneImpl(const DataTypeManager::ConfigureResult& result); 86 void OnConfigureDoneImpl(const DataTypeManager::ConfigureResult& result);
87 87
88 const std::string name_; 88 const std::string name_;
89 csync::UserShare* user_share_; 89 syncer::UserShare* user_share_;
90 ProfileSyncService* service_; 90 ProfileSyncService* service_;
91 DataTypeManager* manager_; 91 DataTypeManager* manager_;
92 92
93 State state_; 93 State state_;
94 94
95 ObserverList<MigrationObserver> migration_observers_; 95 ObserverList<MigrationObserver> migration_observers_;
96 96
97 syncable::ModelTypeSet to_migrate_; 97 syncable::ModelTypeSet to_migrate_;
98 98
99 base::WeakPtrFactory<BackendMigrator> weak_ptr_factory_; 99 base::WeakPtrFactory<BackendMigrator> weak_ptr_factory_;
100 100
101 base::Closure migration_done_callback_; 101 base::Closure migration_done_callback_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(BackendMigrator); 103 DISALLOW_COPY_AND_ASSIGN(BackendMigrator);
104 }; 104 };
105 105
106 } // namespace browser_sync 106 } // namespace browser_sync
107 107
108 #endif // CHROME_BROWSER_SYNC_BACKEND_MIGRATOR_H_ 108 #endif // CHROME_BROWSER_SYNC_BACKEND_MIGRATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/abstract_profile_sync_service_test.cc ('k') | chrome/browser/sync/backend_migrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698