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 "components/sync/syncable/entry_kernel.h" | 5 #include "components/sync/syncable/entry_kernel.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 value->SetBoolean("encrypted", true); | 114 value->SetBoolean("encrypted", true); |
115 } else { | 115 } else { |
116 value = EntitySpecificsToValue(kernel.ref(field)); | 116 value = EntitySpecificsToValue(kernel.ref(field)); |
117 } | 117 } |
118 dictionary_value->Set(key, std::move(value)); | 118 dictionary_value->Set(key, std::move(value)); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 // Helper functions for SetFieldValues(). | 122 // Helper functions for SetFieldValues(). |
123 | 123 |
124 base::StringValue* Int64ToValue(int64_t i) { | 124 base::Value* Int64ToValue(int64_t i) { |
125 return new base::StringValue(base::Int64ToString(i)); | 125 return new base::Value(base::Int64ToString(i)); |
126 } | 126 } |
127 | 127 |
128 base::StringValue* TimeToValue(const base::Time& t) { | 128 base::Value* TimeToValue(const base::Time& t) { |
129 return new base::StringValue(GetTimeDebugString(t)); | 129 return new base::Value(GetTimeDebugString(t)); |
130 } | 130 } |
131 | 131 |
132 base::StringValue* IdToValue(const Id& id) { | 132 base::Value* IdToValue(const Id& id) { |
133 return id.ToValue(); | 133 return id.ToValue(); |
134 } | 134 } |
135 | 135 |
136 base::Value* BooleanToValue(bool bool_val) { | 136 base::Value* BooleanToValue(bool bool_val) { |
137 return new base::Value(bool_val); | 137 return new base::Value(bool_val); |
138 } | 138 } |
139 | 139 |
140 base::StringValue* StringToValue(const std::string& str) { | 140 base::Value* StringToValue(const std::string& str) { |
141 return new base::StringValue(str); | 141 return new base::Value(str); |
142 } | 142 } |
143 | 143 |
144 base::StringValue* UniquePositionToValue(const UniquePosition& pos) { | 144 base::Value* UniquePositionToValue(const UniquePosition& pos) { |
145 return new base::StringValue(pos.ToDebugString()); | 145 return new base::Value(pos.ToDebugString()); |
146 } | 146 } |
147 | 147 |
148 base::StringValue* AttachmentMetadataToValue( | 148 base::Value* AttachmentMetadataToValue(const sync_pb::AttachmentMetadata& a) { |
149 const sync_pb::AttachmentMetadata& a) { | 149 return new base::Value(a.SerializeAsString()); |
150 return new base::StringValue(a.SerializeAsString()); | |
151 } | 150 } |
152 | 151 |
153 } // namespace | 152 } // namespace |
154 | 153 |
155 base::DictionaryValue* EntryKernel::ToValue( | 154 base::DictionaryValue* EntryKernel::ToValue( |
156 Cryptographer* cryptographer) const { | 155 Cryptographer* cryptographer) const { |
157 base::DictionaryValue* kernel_info = new base::DictionaryValue(); | 156 base::DictionaryValue* kernel_info = new base::DictionaryValue(); |
158 kernel_info->SetBoolean("isDirty", is_dirty()); | 157 kernel_info->SetBoolean("isDirty", is_dirty()); |
159 ModelType dataType = GetServerModelType(); | 158 ModelType dataType = GetServerModelType(); |
160 if (!IsRealDataType(dataType)) | 159 if (!IsRealDataType(dataType)) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 os << "TempFlags: "; | 286 os << "TempFlags: "; |
288 for (; i < BIT_TEMPS_END; ++i) { | 287 for (; i < BIT_TEMPS_END; ++i) { |
289 if (kernel->ref(static_cast<BitTemp>(i))) | 288 if (kernel->ref(static_cast<BitTemp>(i))) |
290 os << "#" << i - BIT_TEMPS_BEGIN << ", "; | 289 os << "#" << i - BIT_TEMPS_BEGIN << ", "; |
291 } | 290 } |
292 return os; | 291 return os; |
293 } | 292 } |
294 | 293 |
295 } // namespace syncable | 294 } // namespace syncable |
296 } // namespace syncer | 295 } // namespace syncer |
OLD | NEW |