| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/internal_api/public/change_record.h" | 5 #include "sync/internal_api/public/change_record.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "sync/internal_api/public/base_node.h" | 9 #include "sync/internal_api/public/base_node.h" |
| 10 #include "sync/internal_api/public/read_node.h" | 10 #include "sync/internal_api/public/read_node.h" |
| 11 #include "sync/protocol/proto_value_conversions.h" | 11 #include "sync/protocol/proto_value_conversions.h" |
| 12 | 12 |
| 13 namespace csync { | 13 namespace syncer { |
| 14 | 14 |
| 15 ChangeRecord::ChangeRecord() | 15 ChangeRecord::ChangeRecord() |
| 16 : id(kInvalidId), action(ACTION_ADD) {} | 16 : id(kInvalidId), action(ACTION_ADD) {} |
| 17 | 17 |
| 18 ChangeRecord::~ChangeRecord() {} | 18 ChangeRecord::~ChangeRecord() {} |
| 19 | 19 |
| 20 DictionaryValue* ChangeRecord::ToValue() const { | 20 DictionaryValue* ChangeRecord::ToValue() const { |
| 21 DictionaryValue* value = new DictionaryValue(); | 21 DictionaryValue* value = new DictionaryValue(); |
| 22 std::string action_str; | 22 std::string action_str; |
| 23 switch (action) { | 23 switch (action) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 action_str = "Unknown"; | 35 action_str = "Unknown"; |
| 36 break; | 36 break; |
| 37 } | 37 } |
| 38 value->SetString("action", action_str); | 38 value->SetString("action", action_str); |
| 39 value->SetString("id", base::Int64ToString(id)); | 39 value->SetString("id", base::Int64ToString(id)); |
| 40 if (action == ACTION_DELETE) { | 40 if (action == ACTION_DELETE) { |
| 41 if (extra.get()) { | 41 if (extra.get()) { |
| 42 value->Set("extra", extra->ToValue()); | 42 value->Set("extra", extra->ToValue()); |
| 43 } | 43 } |
| 44 value->Set("specifics", | 44 value->Set("specifics", |
| 45 csync::EntitySpecificsToValue(specifics)); | 45 syncer::EntitySpecificsToValue(specifics)); |
| 46 } | 46 } |
| 47 return value; | 47 return value; |
| 48 } | 48 } |
| 49 | 49 |
| 50 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData() {} | 50 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData() {} |
| 51 | 51 |
| 52 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData( | 52 ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData( |
| 53 const sync_pb::PasswordSpecificsData& data) | 53 const sync_pb::PasswordSpecificsData& data) |
| 54 : unencrypted_(data) { | 54 : unencrypted_(data) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 ExtraPasswordChangeRecordData::~ExtraPasswordChangeRecordData() {} | 57 ExtraPasswordChangeRecordData::~ExtraPasswordChangeRecordData() {} |
| 58 | 58 |
| 59 DictionaryValue* ExtraPasswordChangeRecordData::ToValue() const { | 59 DictionaryValue* ExtraPasswordChangeRecordData::ToValue() const { |
| 60 return csync::PasswordSpecificsDataToValue(unencrypted_); | 60 return syncer::PasswordSpecificsDataToValue(unencrypted_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 const sync_pb::PasswordSpecificsData& | 63 const sync_pb::PasswordSpecificsData& |
| 64 ExtraPasswordChangeRecordData::unencrypted() const { | 64 ExtraPasswordChangeRecordData::unencrypted() const { |
| 65 return unencrypted_; | 65 return unencrypted_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace csync | 68 } // namespace syncer |
| 69 | 69 |
| OLD | NEW |