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.
5 #include "sync/internal_api/public/change_record.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "base/values.h"
9 #include "sync/internal_api/public/base_node.h"
10 #include "sync/internal_api/public/read_node.h"
11 #include "sync/protocol/proto_value_conversions.h"
15 ChangeRecord::ChangeRecord()
16 : id(kInvalidId
), action(ACTION_ADD
) {}
18 ChangeRecord::~ChangeRecord() {}
20 scoped_ptr
<base::DictionaryValue
> ChangeRecord::ToValue() const {
21 scoped_ptr
<base::DictionaryValue
> value(new base::DictionaryValue());
22 std::string action_str
;
28 action_str
= "Delete";
31 action_str
= "Update";
35 action_str
= "Unknown";
38 value
->SetString("action", action_str
);
39 value
->SetString("id", base::Int64ToString(id
));
40 if (action
== ACTION_DELETE
) {
42 value
->Set("extra", extra
->ToValue());
44 value
->Set("specifics", EntitySpecificsToValue(specifics
));
49 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData() {}
51 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData(
52 const sync_pb::PasswordSpecificsData
& data
)
53 : unencrypted_(data
) {
56 ExtraPasswordChangeRecordData::~ExtraPasswordChangeRecordData() {}
58 scoped_ptr
<base::DictionaryValue
> ExtraPasswordChangeRecordData::ToValue()
60 return PasswordSpecificsDataToValue(unencrypted_
);
63 const sync_pb::PasswordSpecificsData
&
64 ExtraPasswordChangeRecordData::unencrypted() const {