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

Side by Side Diff: sync/internal_api/change_record.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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 unified diff | Download patch
« no previous file with comments | « sync/internal_api/base_transaction.cc ('k') | sync/internal_api/change_reorder_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "sync/internal_api/public/change_record.h"
6
7 #include <string>
8
9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h"
11 #include "sync/internal_api/public/base_node.h"
12 #include "sync/internal_api/public/read_node.h"
13 #include "sync/protocol/proto_value_conversions.h"
14
15 namespace syncer {
16
17 ChangeRecord::ChangeRecord()
18 : id(kInvalidId), action(ACTION_ADD) {}
19
20 ChangeRecord::ChangeRecord(const ChangeRecord& other) = default;
21
22 ChangeRecord::~ChangeRecord() {}
23
24 std::unique_ptr<base::DictionaryValue> ChangeRecord::ToValue() const {
25 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
26 std::string action_str;
27 switch (action) {
28 case ACTION_ADD:
29 action_str = "Add";
30 break;
31 case ACTION_DELETE:
32 action_str = "Delete";
33 break;
34 case ACTION_UPDATE:
35 action_str = "Update";
36 break;
37 default:
38 NOTREACHED();
39 action_str = "Unknown";
40 break;
41 }
42 value->SetString("action", action_str);
43 value->SetString("id", base::Int64ToString(id));
44 if (action == ACTION_DELETE) {
45 if (extra.get()) {
46 value->Set("extra", extra->ToValue());
47 }
48 value->Set("specifics", EntitySpecificsToValue(specifics));
49 }
50 return value;
51 }
52
53 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData() {}
54
55 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData(
56 const sync_pb::PasswordSpecificsData& data)
57 : unencrypted_(data) {
58 }
59
60 ExtraPasswordChangeRecordData::~ExtraPasswordChangeRecordData() {}
61
62 std::unique_ptr<base::DictionaryValue> ExtraPasswordChangeRecordData::ToValue()
63 const {
64 return PasswordSpecificsDataToValue(unencrypted_);
65 }
66
67 const sync_pb::PasswordSpecificsData&
68 ExtraPasswordChangeRecordData::unencrypted() const {
69 return unencrypted_;
70 }
71
72 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/base_transaction.cc ('k') | sync/internal_api/change_reorder_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698