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

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

Issue 7564037: Apps/Extensions Sync refactoring -- delete most of the old glue, implement new sync API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 4 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/extension_sync_data.h
diff --git a/chrome/browser/extensions/extension_sync_data.h b/chrome/browser/extensions/extension_sync_data.h
index 312103d6f9a394bb0f93b4cb6f733b9556aac074..ef4f07866686a1d4c82252e2730ba07cecd6f7ee 100644
--- a/chrome/browser/extensions/extension_sync_data.h
+++ b/chrome/browser/extensions/extension_sync_data.h
@@ -9,34 +9,60 @@
#include <string>
#include "base/version.h"
+#include "chrome/browser/sync/api/sync_change.h"
+#include "chrome/common/extensions/extension.h"
#include "googleurl/src/gurl.h"
-// A struct that encapsulates the synced properties of an Extension.
-struct ExtensionSyncData {
+class ExtensionService;
+class SyncData;
akalin 2011/08/12 03:35:02 need to #include sync_data.h, since you're returni
+namespace sync_pb { class ExtensionSpecifics; }
+
+// A class that encapsulates the synced properties of an Extension.
+class ExtensionSyncData {
+ public:
ExtensionSyncData();
+ explicit ExtensionSyncData(const SyncData& sync_data);
+ explicit ExtensionSyncData(const SyncChange& sync_change);
+ ExtensionSyncData(const Extension& extension,
+ bool enabled,
+ bool incognito_enabled);
~ExtensionSyncData();
- // Merge |new_data| into this object. All version-independent
- // properties are copied from |new_data|, and version-dependent
- // properties are copied only if |new_data|'s version is equal to or
- // greater than the current version.
- void Merge(const ExtensionSyncData& new_data);
+ // Convert an ExtensionSyncData back out to a sync structure.
+ void PopulateSyncSpecifics(sync_pb::ExtensionSpecifics* specifics) const;
+ SyncData GetSyncData() const;
+ SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const;
- std::string id;
+ std::string id() const { return id_; }
asargent_no_longer_on_chrome 2011/08/12 20:50:39 nit: should return "const std::string&"
// Version-independent properties (i.e., used even when the
// version of the currently-installed extension doesn't match
// |version|).
- bool uninstalled;
- bool enabled;
- bool incognito_enabled;
+ bool uninstalled() const { return uninstalled_; }
+ bool enabled() const { return enabled_; }
+ bool incognito_enabled() const { return incognito_enabled_; }
+ Extension::SyncType type() const { return type_; }
// Version-dependent properties (i.e., should be used only when the
// version of the currenty-installed extension matches |version|).
- Version version;
- GURL update_url;
+ Version version() const { return version_; }
asargent_no_longer_on_chrome 2011/08/12 20:50:39 nit: should return "const Version&"
+ GURL update_url() const { return update_url_; }
// Used only for debugging.
- std::string name;
+ std::string name() const { return name_; }
+
+ private:
+ void PopulateFromExtensionSpecifics(
+ const sync_pb::ExtensionSpecifics& specifics);
+ void PopulateFromSyncData(const SyncData& sync_data);
+
+ std::string id_;
+ bool uninstalled_;
+ bool enabled_;
+ bool incognito_enabled_;
+ Extension::SyncType type_;
+ Version version_;
+ GURL update_url_;
+ std::string name_;
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698