summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/sync_bundle.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/sync_bundle.h')
-rw-r--r--chrome/browser/extensions/sync_bundle.h40
1 files changed, 17 insertions, 23 deletions
diff --git a/chrome/browser/extensions/sync_bundle.h b/chrome/browser/extensions/sync_bundle.h
index 750933f..adebbb1 100644
--- a/chrome/browser/extensions/sync_bundle.h
+++ b/chrome/browser/extensions/sync_bundle.h
@@ -17,34 +17,23 @@ class ExtensionSyncService;
namespace extensions {
-class Extension;
class ExtensionSyncData;
class SyncBundle {
public:
- explicit SyncBundle(ExtensionSyncService* sync_service);
+ SyncBundle();
~SyncBundle();
- void MergeDataAndStartSyncing(
- const syncer::SyncDataList& initial_sync_data,
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor);
+ void StartSyncing(scoped_ptr<syncer::SyncChangeProcessor> sync_processor);
// Resets this class back to its default values, which will disable all
// syncing until StartSyncing is called again.
void Reset();
// Has this bundle started syncing yet?
- // Returns true if MergeDataAndStartSyncing has been called, false otherwise.
+ // Returns true if StartSyncing has been called, false otherwise.
bool IsSyncing() const;
- // Checks if the extension with the given |id| is synced.
- bool HasExtensionId(const std::string& id) const;
-
- // Whether the given extension should be included in the SyncDataList to be
- // sent to the server. Returns false if there is pending data that should be
- // used instead.
- bool ShouldIncludeInLocalSyncDataList(const Extension& extension) const;
-
// Handles the given list of local SyncDatas. This updates the set of synced
// extensions as appropriate, and then pushes the corresponding SyncChanges
// to the server.
@@ -57,12 +46,15 @@ class SyncBundle {
const syncer::SyncData& sync_data);
// Pushes any sync changes to |extension| to the server.
- void PushSyncAddOrUpdate(const Extension& extension);
+ void PushSyncAddOrUpdate(const std::string& extension_id,
+ const syncer::SyncData& sync_data);
- // Applies the given SyncChange coming from the server.
- void ApplySyncChange(const syncer::SyncChange& sync_change);
+ // Applies the given sync change coming in from the server. This just updates
+ // the list of synced extensions.
+ void ApplySyncData(const ExtensionSyncData& extension_sync_data);
- // Checks if the extension with the given |id| is pending to be synced.
+ // Checks if there is pending sync data for the extension with the given |id|
+ // that should be sent to the server instead of the local state.
bool HasPendingExtensionId(const std::string& id) const;
// Adds a pending extension to be synced.
@@ -82,16 +74,18 @@ class SyncBundle {
void AddSyncedExtension(const std::string& id);
void RemoveSyncedExtension(const std::string& id);
-
- // Changes an extension from being pending to synced.
- void MarkPendingExtensionSynced(const std::string& id);
-
- ExtensionSyncService* sync_service_; // Owns us.
+ bool HasSyncedExtension(const std::string& id) const;
scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
+ // Stores the set of extensions we know about. Used to decide if a sync change
+ // should be ACTION_ADD or ACTION_UPDATE.
std::set<std::string> synced_extensions_;
+ // This stores changes we got from sync that we couldn't apply immediately
+ // (such as installing a new extension, or an update). We'll send this back
+ // to the server instead of the local state, to prevent the sync state from
+ // flipping back and forth until all clients are on the same state.
std::map<std::string, ExtensionSyncData> pending_sync_data_;
DISALLOW_COPY_AND_ASSIGN(SyncBundle);