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

Unified Diff: sync/api/attachments/attachment.cc

Issue 187303006: Update sync API to support attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachmentapi
Patch Set: Pull in upstream changes. 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
Index: sync/api/attachments/attachment.cc
diff --git a/sync/api/attachments/attachment.cc b/sync/api/attachments/attachment.cc
index 896ff1fbde1b8bf4ef7237a55149b47f1fadd54d..a6d0b8e744d99e0d677067e2cd48ef5fb0fd5c85 100644
--- a/sync/api/attachments/attachment.cc
+++ b/sync/api/attachments/attachment.cc
@@ -12,16 +12,25 @@ namespace syncer {
Attachment::~Attachment() {}
// Static.
-scoped_ptr<Attachment> Attachment::Create(
+sync_pb::AttachmentId Attachment::CreateId() {
+ sync_pb::AttachmentId result;
+ // Only requirement here is that this id must be globally unique.
+ // TODO(maniscalco): Consider making this base64 encoded.
+ result.set_unique_id(base::RandBytesAsString(16));
+ return result;
+}
+
+// Static.
+Attachment Attachment::Create(
const scoped_refptr<base::RefCountedMemory>& data) {
return CreateWithId(CreateId(), data);
}
// Static.
-scoped_ptr<Attachment> Attachment::CreateWithId(
+Attachment Attachment::CreateWithId(
const sync_pb::AttachmentId& id,
const scoped_refptr<base::RefCountedMemory>& data) {
- return scoped_ptr<Attachment>(new Attachment(id, data)).Pass();
+ return Attachment(id, data);
}
const sync_pb::AttachmentId& Attachment::GetId() const { return id_; }
@@ -37,13 +46,4 @@ Attachment::Attachment(const sync_pb::AttachmentId& id,
DCHECK(data);
}
-// Static.
-sync_pb::AttachmentId Attachment::CreateId() {
- sync_pb::AttachmentId result;
- // Only requirement here is that this id must be globally unique.
- // TODO(maniscalco): Consider making this base64 encoded.
- result.set_unique_id(base::RandBytesAsString(16));
- return result;
-}
-
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698