| 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 // Keep this file in sync with the .proto files in this directory. | 5 // Keep this file in sync with the .proto files in this directory. |
| 6 | 6 |
| 7 #include "sync/protocol/proto_value_conversions.h" | 7 #include "sync/protocol/proto_value_conversions.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 } | 806 } |
| 807 | 807 |
| 808 namespace { | 808 namespace { |
| 809 | 809 |
| 810 base::StringValue* UniquePositionToStringValue( | 810 base::StringValue* UniquePositionToStringValue( |
| 811 const sync_pb::UniquePosition& proto) { | 811 const sync_pb::UniquePosition& proto) { |
| 812 UniquePosition pos = UniquePosition::FromProto(proto); | 812 UniquePosition pos = UniquePosition::FromProto(proto); |
| 813 return new base::StringValue(pos.ToDebugString()); | 813 return new base::StringValue(pos.ToDebugString()); |
| 814 } | 814 } |
| 815 | 815 |
| 816 } // namespace |
| 817 |
| 816 base::DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto, | 818 base::DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto, |
| 817 bool include_specifics) { | 819 bool include_specifics) { |
| 818 base::DictionaryValue* value = new base::DictionaryValue(); | 820 base::DictionaryValue* value = new base::DictionaryValue(); |
| 819 SET_STR(id_string); | 821 SET_STR(id_string); |
| 820 SET_STR(parent_id_string); | 822 SET_STR(parent_id_string); |
| 821 SET_STR(old_parent_id); | 823 SET_STR(old_parent_id); |
| 822 SET_INT64(version); | 824 SET_INT64(version); |
| 823 SET_INT64(mtime); | 825 SET_INT64(mtime); |
| 824 SET_INT64(ctime); | 826 SET_INT64(ctime); |
| 825 SET_STR(name); | 827 SET_STR(name); |
| 826 SET_STR(non_unique_name); | 828 SET_STR(non_unique_name); |
| 827 SET_INT64(sync_timestamp); | 829 SET_INT64(sync_timestamp); |
| 828 SET_STR(server_defined_unique_tag); | 830 SET_STR(server_defined_unique_tag); |
| 829 SET_INT64(position_in_parent); | 831 SET_INT64(position_in_parent); |
| 830 SET(unique_position, UniquePositionToStringValue); | 832 SET(unique_position, UniquePositionToStringValue); |
| 831 SET_STR(insert_after_item_id); | 833 SET_STR(insert_after_item_id); |
| 832 SET_BOOL(deleted); | 834 SET_BOOL(deleted); |
| 833 SET_STR(originator_cache_guid); | 835 SET_STR(originator_cache_guid); |
| 834 SET_STR(originator_client_item_id); | 836 SET_STR(originator_client_item_id); |
| 835 if (include_specifics) | 837 if (include_specifics) |
| 836 SET(specifics, EntitySpecificsToValue); | 838 SET(specifics, EntitySpecificsToValue); |
| 837 SET_BOOL(folder); | 839 SET_BOOL(folder); |
| 838 SET_STR(client_defined_unique_tag); | 840 SET_STR(client_defined_unique_tag); |
| 839 return value; | 841 return value; |
| 840 } | 842 } |
| 841 | 843 |
| 844 namespace { |
| 845 |
| 842 base::ListValue* SyncEntitiesToValue( | 846 base::ListValue* SyncEntitiesToValue( |
| 843 const ::google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>& entities, | 847 const ::google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>& entities, |
| 844 bool include_specifics) { | 848 bool include_specifics) { |
| 845 base::ListValue* list = new base::ListValue(); | 849 base::ListValue* list = new base::ListValue(); |
| 846 ::google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>::const_iterator it; | 850 ::google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>::const_iterator it; |
| 847 for (it = entities.begin(); it != entities.end(); ++it) { | 851 for (it = entities.begin(); it != entities.end(); ++it) { |
| 848 list->Append(SyncEntityToValue(*it, include_specifics)); | 852 list->Append(SyncEntityToValue(*it, include_specifics)); |
| 849 } | 853 } |
| 850 | 854 |
| 851 return list; | 855 return list; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 #undef SET_BYTES | 1108 #undef SET_BYTES |
| 1105 #undef SET_INT32 | 1109 #undef SET_INT32 |
| 1106 #undef SET_INT64 | 1110 #undef SET_INT64 |
| 1107 #undef SET_INT64_REP | 1111 #undef SET_INT64_REP |
| 1108 #undef SET_STR | 1112 #undef SET_STR |
| 1109 #undef SET_STR_REP | 1113 #undef SET_STR_REP |
| 1110 | 1114 |
| 1111 #undef SET_FIELD | 1115 #undef SET_FIELD |
| 1112 | 1116 |
| 1113 } // namespace syncer | 1117 } // namespace syncer |
| OLD | NEW |