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

Unified Diff: sync/api/attachments/attachment_id.h

Issue 187303006: Update sync API to support attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachmentapi
Patch Set: Rename GetAttachments to GetLocalAttachmentsForUpload. Created 6 years, 9 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 | « sync/api/attachments/attachment.cc ('k') | sync/api/attachments/attachment_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/attachments/attachment_id.h
diff --git a/sync/api/attachments/attachment_id.h b/sync/api/attachments/attachment_id.h
index 9fd29dc0913a0adb4a5b6fc537a815c171e463cc..57a0088207d78b8d75d4756eed39f6a5ad0f3701 100644
--- a/sync/api/attachments/attachment_id.h
+++ b/sync/api/attachments/attachment_id.h
@@ -9,6 +9,11 @@
#include <vector>
#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/util/immutable.h"
+
+namespace sync_pb {
+class AttachmentIdProto;
+} // namespace sync_pb
namespace syncer {
@@ -29,14 +34,34 @@ class SYNC_EXPORT AttachmentId {
// Needed for using AttachmentId as key in std::map.
bool operator<(const AttachmentId& other) const;
-
// Creates a unique attachment id.
static AttachmentId Create();
- private:
- std::string unique_id_;
+ // Creates an attachment id from an initialized proto.
+ static AttachmentId CreateFromProto(const sync_pb::AttachmentIdProto& proto);
- AttachmentId(const std::string& unique_id);
+ const sync_pb::AttachmentIdProto& GetProto() const;
+
+ private:
+ // Necessary since we forward-declare sync_pb::AttachmentIdProto; see comments
+ // in immutable.h.
+ struct ImmutableAttachmentIdProtoTraits {
+ typedef sync_pb::AttachmentIdProto* Wrapper;
+ static void InitializeWrapper(Wrapper* wrapper);
+ static void DestroyWrapper(Wrapper* wrapper);
+ static const sync_pb::AttachmentIdProto& Unwrap(const Wrapper& wrapper);
+ static sync_pb::AttachmentIdProto* UnwrapMutable(Wrapper* wrapper);
+ static void Swap(sync_pb::AttachmentIdProto* t1,
+ sync_pb::AttachmentIdProto* t2);
+ };
+
+ typedef Immutable<sync_pb::AttachmentIdProto,
+ ImmutableAttachmentIdProtoTraits>
+ ImmutableAttachmentIdProto;
+
+ ImmutableAttachmentIdProto proto_;
+
+ AttachmentId(sync_pb::AttachmentIdProto* proto);
};
typedef std::vector<AttachmentId> AttachmentIdList;
« no previous file with comments | « sync/api/attachments/attachment.cc ('k') | sync/api/attachments/attachment_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698