OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/syncable/syncable.h" | 5 #include "chrome/browser/sync/syncable/syncable.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 T field = static_cast<T>(i); | 266 T field = static_cast<T>(i); |
267 const std::string& key = enum_key_fn(field); | 267 const std::string& key = enum_key_fn(field); |
268 V* value = enum_value_fn(kernel.ref(field)); | 268 V* value = enum_value_fn(kernel.ref(field)); |
269 dictionary_value->Set(key, value); | 269 dictionary_value->Set(key, value); |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 // Helper functions for SetFieldValues(). | 273 // Helper functions for SetFieldValues(). |
274 | 274 |
275 StringValue* Int64ToValue(int64 i) { | 275 StringValue* Int64ToValue(int64 i) { |
276 return Value::CreateStringValue(base::Int64ToString(i)); | 276 return base::StringValue::New(base::Int64ToString(i)); |
277 } | 277 } |
278 | 278 |
279 StringValue* IdToValue(const Id& id) { | 279 StringValue* IdToValue(const Id& id) { |
280 return id.ToValue(); | 280 return id.ToValue(); |
281 } | 281 } |
282 | 282 |
283 } // namespace | 283 } // namespace |
284 | 284 |
285 DictionaryValue* EntryKernel::ToValue() const { | 285 DictionaryValue* EntryKernel::ToValue() const { |
286 DictionaryValue* kernel_info = new DictionaryValue(); | 286 DictionaryValue* kernel_info = new DictionaryValue(); |
(...skipping 10 matching lines...) Expand all Loading... |
297 &GetInt64FieldString, &Int64ToValue, | 297 &GetInt64FieldString, &Int64ToValue, |
298 BASE_VERSION + 1, INT64_FIELDS_END - 1); | 298 BASE_VERSION + 1, INT64_FIELDS_END - 1); |
299 | 299 |
300 // ID fields. | 300 // ID fields. |
301 SetFieldValues(*this, kernel_info, | 301 SetFieldValues(*this, kernel_info, |
302 &GetIdFieldString, &IdToValue, | 302 &GetIdFieldString, &IdToValue, |
303 ID_FIELDS_BEGIN, ID_FIELDS_END - 1); | 303 ID_FIELDS_BEGIN, ID_FIELDS_END - 1); |
304 | 304 |
305 // Bit fields. | 305 // Bit fields. |
306 SetFieldValues(*this, kernel_info, | 306 SetFieldValues(*this, kernel_info, |
307 &GetIndexedBitFieldString, &Value::CreateBooleanValue, | 307 &GetIndexedBitFieldString, &base::BooleanValue::New, |
308 BIT_FIELDS_BEGIN, INDEXED_BIT_FIELDS_END - 1); | 308 BIT_FIELDS_BEGIN, INDEXED_BIT_FIELDS_END - 1); |
309 SetFieldValues(*this, kernel_info, | 309 SetFieldValues(*this, kernel_info, |
310 &GetIsDelFieldString, &Value::CreateBooleanValue, | 310 &GetIsDelFieldString, &base::BooleanValue::New, |
311 INDEXED_BIT_FIELDS_END, IS_DEL); | 311 INDEXED_BIT_FIELDS_END, IS_DEL); |
312 SetFieldValues(*this, kernel_info, | 312 SetFieldValues(*this, kernel_info, |
313 &GetBitFieldString, &Value::CreateBooleanValue, | 313 &GetBitFieldString, &base::BooleanValue::New, |
314 IS_DEL + 1, BIT_FIELDS_END - 1); | 314 IS_DEL + 1, BIT_FIELDS_END - 1); |
315 | 315 |
316 // String fields. | 316 // String fields. |
317 { | 317 { |
318 // Pick out the function overload we want. | 318 // Pick out the function overload we want. |
319 StringValue* (*string_to_value)(const std::string&) = | 319 StringValue* (*string_to_value)(const std::string&) = |
320 &Value::CreateStringValue; | 320 &base::StringValue::New; |
321 SetFieldValues(*this, kernel_info, | 321 SetFieldValues(*this, kernel_info, |
322 &GetStringFieldString, string_to_value, | 322 &GetStringFieldString, string_to_value, |
323 STRING_FIELDS_BEGIN, STRING_FIELDS_END - 1); | 323 STRING_FIELDS_BEGIN, STRING_FIELDS_END - 1); |
324 } | 324 } |
325 | 325 |
326 // Proto fields. | 326 // Proto fields. |
327 SetFieldValues(*this, kernel_info, | 327 SetFieldValues(*this, kernel_info, |
328 &GetProtoFieldString, &browser_sync::EntitySpecificsToValue, | 328 &GetProtoFieldString, &browser_sync::EntitySpecificsToValue, |
329 PROTO_FIELDS_BEGIN, PROTO_FIELDS_END - 1); | 329 PROTO_FIELDS_BEGIN, PROTO_FIELDS_END - 1); |
330 | 330 |
331 // Bit temps. | 331 // Bit temps. |
332 SetFieldValues(*this, kernel_info, | 332 SetFieldValues(*this, kernel_info, |
333 &GetBitTempString, &Value::CreateBooleanValue, | 333 &GetBitTempString, &base::BooleanValue::New, |
334 BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); | 334 BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); |
335 | 335 |
336 return kernel_info; | 336 return kernel_info; |
337 } | 337 } |
338 | 338 |
339 /////////////////////////////////////////////////////////////////////////// | 339 /////////////////////////////////////////////////////////////////////////// |
340 // Directory | 340 // Directory |
341 | 341 |
342 void Directory::InitKernel(const std::string& name, | 342 void Directory::InitKernel(const std::string& name, |
343 DirectoryChangeDelegate* delegate) { | 343 DirectoryChangeDelegate* delegate) { |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 CHECK(result); | 1940 CHECK(result); |
1941 for (iterator i = GetParentChildIndexLowerBound(lock, parent_id), | 1941 for (iterator i = GetParentChildIndexLowerBound(lock, parent_id), |
1942 end = GetParentChildIndexUpperBound(lock, parent_id); | 1942 end = GetParentChildIndexUpperBound(lock, parent_id); |
1943 i != end; ++i) { | 1943 i != end; ++i) { |
1944 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); | 1944 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); |
1945 result->push_back((*i)->ref(META_HANDLE)); | 1945 result->push_back((*i)->ref(META_HANDLE)); |
1946 } | 1946 } |
1947 } | 1947 } |
1948 | 1948 |
1949 } // namespace syncable | 1949 } // namespace syncable |
OLD | NEW |