| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/api/attachments/attachment_id.h" | 5 #include "sync/api/attachments/attachment_id.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "sync/internal_api/public/base/attachment_id_proto.h" | 8 #include "sync/internal_api/public/base/attachment_id_proto.h" |
| 9 #include "sync/protocol/sync.pb.h" | 9 #include "sync/protocol/sync.pb.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 bool AttachmentId::operator!=(const AttachmentId& other) const { | 46 bool AttachmentId::operator!=(const AttachmentId& other) const { |
| 47 return !operator==(other); | 47 return !operator==(other); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool AttachmentId::operator<(const AttachmentId& other) const { | 50 bool AttachmentId::operator<(const AttachmentId& other) const { |
| 51 return proto_.Get().unique_id() < other.proto_.Get().unique_id(); | 51 return proto_.Get().unique_id() < other.proto_.Get().unique_id(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Static. | 54 // Static. |
| 55 AttachmentId AttachmentId::Create() { | 55 AttachmentId AttachmentId::Create(size_t size, uint32_t crc32c) { |
| 56 sync_pb::AttachmentIdProto proto = CreateAttachmentIdProto(); | 56 sync_pb::AttachmentIdProto proto = CreateAttachmentIdProto(size, crc32c); |
| 57 return AttachmentId(&proto); | 57 return AttachmentId(&proto); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Static. | 60 // Static. |
| 61 AttachmentId AttachmentId::CreateFromProto( | 61 AttachmentId AttachmentId::CreateFromProto( |
| 62 const sync_pb::AttachmentIdProto& proto) { | 62 const sync_pb::AttachmentIdProto& proto) { |
| 63 sync_pb::AttachmentIdProto copy_of_proto(proto); | 63 sync_pb::AttachmentIdProto copy_of_proto(proto); |
| 64 return AttachmentId(©_of_proto); | 64 return AttachmentId(©_of_proto); |
| 65 } | 65 } |
| 66 | 66 |
| 67 const sync_pb::AttachmentIdProto& AttachmentId::GetProto() const { | 67 const sync_pb::AttachmentIdProto& AttachmentId::GetProto() const { |
| 68 return proto_.Get(); | 68 return proto_.Get(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 AttachmentId::AttachmentId(sync_pb::AttachmentIdProto* proto) | 71 AttachmentId::AttachmentId(sync_pb::AttachmentIdProto* proto) |
| 72 : proto_(proto) {} | 72 : proto_(proto) {} |
| 73 | 73 |
| 74 size_t AttachmentId::GetSize() const { |
| 75 return proto_.Get().size_bytes(); |
| 76 } |
| 77 |
| 78 uint32_t AttachmentId::GetCrc32c() const { |
| 79 return proto_.Get().crc32c(); |
| 80 } |
| 81 |
| 74 } // namespace syncer | 82 } // namespace syncer |
| OLD | NEW |