| 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/syncable/entry_kernel.h" | 5 #include "sync/syncable/entry_kernel.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "sync/protocol/proto_value_conversions.h" | 8 #include "sync/protocol/proto_value_conversions.h" |
| 9 #include "sync/syncable/syncable_enum_conversions.h" | 9 #include "sync/syncable/syncable_enum_conversions.h" |
| 10 | 10 |
| 11 namespace syncer { | 11 namespace syncer { |
| 12 namespace syncable { | 12 namespace syncable { |
| 13 | 13 |
| 14 EntryKernel::EntryKernel() : dirty_(false) { | 14 EntryKernel::EntryKernel() : dirty_(false) { |
| 15 // Everything else should already be default-initialized. | 15 // Everything else should already be default-initialized. |
| 16 for (int i = INT64_FIELDS_BEGIN; i < INT64_FIELDS_END; ++i) { | 16 for (int i = INT64_FIELDS_BEGIN; i < INT64_FIELDS_END; ++i) { |
| 17 int64_fields[i] = 0; | 17 int64_fields[i] = 0; |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 | 20 |
| 21 EntryKernel::~EntryKernel() {} | 21 EntryKernel::~EntryKernel() {} |
| 22 | 22 |
| 23 syncable::ModelType EntryKernel::GetServerModelType() const { | 23 syncer::ModelType EntryKernel::GetServerModelType() const { |
| 24 ModelType specifics_type = GetModelTypeFromSpecifics(ref(SERVER_SPECIFICS)); | 24 ModelType specifics_type = GetModelTypeFromSpecifics(ref(SERVER_SPECIFICS)); |
| 25 if (specifics_type != UNSPECIFIED) | 25 if (specifics_type != UNSPECIFIED) |
| 26 return specifics_type; | 26 return specifics_type; |
| 27 if (ref(ID).IsRoot()) | 27 if (ref(ID).IsRoot()) |
| 28 return TOP_LEVEL_FOLDER; | 28 return TOP_LEVEL_FOLDER; |
| 29 // Loose check for server-created top-level folders that aren't | 29 // Loose check for server-created top-level folders that aren't |
| 30 // bound to a particular model type. | 30 // bound to a particular model type. |
| 31 if (!ref(UNIQUE_SERVER_TAG).empty() && ref(SERVER_IS_DIR)) | 31 if (!ref(UNIQUE_SERVER_TAG).empty() && ref(SERVER_IS_DIR)) |
| 32 return TOP_LEVEL_FOLDER; | 32 return TOP_LEVEL_FOLDER; |
| 33 | 33 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 DictionaryValue* EntryKernelMutationToValue( | 144 DictionaryValue* EntryKernelMutationToValue( |
| 145 const EntryKernelMutation& mutation) { | 145 const EntryKernelMutation& mutation) { |
| 146 DictionaryValue* dict = new DictionaryValue(); | 146 DictionaryValue* dict = new DictionaryValue(); |
| 147 dict->Set("original", mutation.original.ToValue()); | 147 dict->Set("original", mutation.original.ToValue()); |
| 148 dict->Set("mutated", mutation.mutated.ToValue()); | 148 dict->Set("mutated", mutation.mutated.ToValue()); |
| 149 return dict; | 149 return dict; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace syncer | 152 } // namespace syncer |
| 153 } // namespace syncable | 153 } // namespace syncable |
| OLD | NEW |