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/protocol/proto_value_conversions.h" | 5 #include "components/sync/protocol/proto_value_conversions.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return base::MakeUnique<base::StringValue>(base::Int64ToString(value)); | 227 return base::MakeUnique<base::StringValue>(base::Int64ToString(value)); |
228 } | 228 } |
229 std::unique_ptr<base::Value> ToValue(uint32_t value) const { | 229 std::unique_ptr<base::Value> ToValue(uint32_t value) const { |
230 return base::MakeUnique<base::StringValue>(base::Int64ToString(value)); | 230 return base::MakeUnique<base::StringValue>(base::Int64ToString(value)); |
231 } | 231 } |
232 std::unique_ptr<base::Value> ToValue(int32_t value) const { | 232 std::unique_ptr<base::Value> ToValue(int32_t value) const { |
233 return base::MakeUnique<base::StringValue>(base::Int64ToString(value)); | 233 return base::MakeUnique<base::StringValue>(base::Int64ToString(value)); |
234 } | 234 } |
235 | 235 |
236 std::unique_ptr<base::Value> ToValue(bool value) const { | 236 std::unique_ptr<base::Value> ToValue(bool value) const { |
237 return base::MakeUnique<base::FundamentalValue>(value); | 237 return base::MakeUnique<base::Value>(value); |
238 } | 238 } |
239 std::unique_ptr<base::Value> ToValue(float value) const { | 239 std::unique_ptr<base::Value> ToValue(float value) const { |
240 return base::MakeUnique<base::FundamentalValue>(value); | 240 return base::MakeUnique<base::Value>(value); |
241 } | 241 } |
242 std::unique_ptr<base::Value> ToValue(double value) const { | 242 std::unique_ptr<base::Value> ToValue(double value) const { |
243 return base::MakeUnique<base::FundamentalValue>(value); | 243 return base::MakeUnique<base::Value>(value); |
244 } | 244 } |
245 | 245 |
246 // Needs to be here to see all ToValue() overloads above. | 246 // Needs to be here to see all ToValue() overloads above. |
247 template <class P, class F> | 247 template <class P, class F> |
248 void VisitImpl(P& proto, const char* field_name, const F& field) { | 248 void VisitImpl(P& proto, const char* field_name, const F& field) { |
249 value_->Set(field_name, ToValue(field)); | 249 value_->Set(field_name, ToValue(field)); |
250 } | 250 } |
251 | 251 |
252 base::DictionaryValue* value_; | 252 base::DictionaryValue* value_; |
253 bool include_specifics_; | 253 bool include_specifics_; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 IMPLEMENT_PROTO_TO_VALUE(WifiCredentialSpecifics) | 328 IMPLEMENT_PROTO_TO_VALUE(WifiCredentialSpecifics) |
329 | 329 |
330 IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS(ClientToServerMessage) | 330 IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS(ClientToServerMessage) |
331 IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS(ClientToServerResponse) | 331 IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS(ClientToServerResponse) |
332 IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS(SyncEntity) | 332 IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS(SyncEntity) |
333 | 333 |
334 #undef IMPLEMENT_PROTO_TO_VALUE | 334 #undef IMPLEMENT_PROTO_TO_VALUE |
335 #undef IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS | 335 #undef IMPLEMENT_PROTO_TO_VALUE_INCLUDE_SPECIFICS |
336 | 336 |
337 } // namespace syncer | 337 } // namespace syncer |
OLD | NEW |