ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / sync / internal_api / public / base / attachment_id_proto.cc
blob52728cdf9f5b75dd974a485f22b4f0de99b0e56f
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
3 // found in the LICENSE file.
5 #include "sync/internal_api/public/base/attachment_id_proto.h"
7 #include "base/guid.h"
8 #include "base/logging.h"
9 #include "base/strings/string_util.h"
11 namespace syncer {
13 sync_pb::AttachmentIdProto CreateAttachmentIdProto() {
14 sync_pb::AttachmentIdProto proto;
15 std::string guid = base::StringToLowerASCII(base::GenerateGUID());
16 DCHECK(!guid.empty());
17 // Requirements are that this id must be a unique RFC4122 UUID, formatted in
18 // lower case.
19 proto.set_unique_id(guid);
20 return proto;
23 sync_pb::AttachmentMetadata CreateAttachmentMetadata(
24 const google::protobuf::RepeatedPtrField<sync_pb::AttachmentIdProto>& ids) {
25 sync_pb::AttachmentMetadata result;
26 for (int i = 0; i < ids.size(); ++i) {
27 sync_pb::AttachmentMetadataRecord* record = result.add_record();
28 *record->mutable_id() = ids.Get(i);
29 record->set_is_on_server(true);
31 return result;
34 } // namespace syncer