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

Unified Diff: chrome/browser/extensions/sync_bundle.h

Issue 1240573012: Extension syncing: Introduce a NeedsSync pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext_sync_uninstall
Patch Set: more cleanup; fix test Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/sync_bundle.h
diff --git a/chrome/browser/extensions/sync_bundle.h b/chrome/browser/extensions/sync_bundle.h
index 750933f5b9163b8cbe43791b6b8946d3446f69b6..b8ede0f24e080a63a6593d0c58c1a36e1b4e5f8d 100644
--- a/chrome/browser/extensions/sync_bundle.h
+++ b/chrome/browser/extensions/sync_bundle.h
@@ -17,7 +17,6 @@ class ExtensionSyncService;
namespace extensions {
-class Extension;
class ExtensionSyncData;
class SyncBundle {
@@ -37,14 +36,6 @@ class SyncBundle {
// Returns true if MergeDataAndStartSyncing 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 +48,14 @@ 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);
- // 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 +75,20 @@ 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);
+ bool HasSyncedExtension(const std::string& id) const;
ExtensionSyncService* sync_service_; // Owns us.
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);

Powered by Google App Engine
This is Rietveld 408576698