Index: components/sync/syncable/entry_kernel.cc |
diff --git a/sync/syncable/entry_kernel.cc b/components/sync/syncable/entry_kernel.cc |
similarity index 81% |
rename from sync/syncable/entry_kernel.cc |
rename to components/sync/syncable/entry_kernel.cc |
index 146bbc8e811e363a11f71a94718aa960a9c3c118..d012d9865e19b9f8cb0c9406cebeaf254067b12c 100644 |
--- a/sync/syncable/entry_kernel.cc |
+++ b/components/sync/syncable/entry_kernel.cc |
@@ -2,17 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "sync/syncable/entry_kernel.h" |
+#include "components/sync/syncable/entry_kernel.h" |
#include <stdint.h> |
+ |
#include <utility> |
#include "base/json/string_escape.h" |
#include "base/strings/string_number_conversions.h" |
-#include "sync/protocol/proto_value_conversions.h" |
-#include "sync/syncable/syncable_columns.h" |
-#include "sync/syncable/syncable_enum_conversions.h" |
-#include "sync/util/cryptographer.h" |
+#include "components/sync/base/cryptographer.h" |
+#include "components/sync/protocol/proto_value_conversions.h" |
+#include "components/sync/syncable/syncable_columns.h" |
+#include "components/sync/syncable/syncable_enum_conversions.h" |
namespace syncer { |
namespace syncable { |
@@ -82,7 +83,8 @@ void SetFieldValues(const EntryKernel& kernel, |
base::DictionaryValue* dictionary_value, |
const char* (*enum_key_fn)(T), |
V* (*enum_value_fn)(U), |
- int field_key_min, int field_key_max) { |
+ int field_key_min, |
+ int field_key_max) { |
DCHECK_LE(field_key_min, field_key_max); |
for (int i = field_key_min; i <= field_key_max; ++i) { |
T field = static_cast<T>(i); |
@@ -92,11 +94,11 @@ void SetFieldValues(const EntryKernel& kernel, |
} |
} |
-void SetEncryptableProtoValues( |
- const EntryKernel& kernel, |
- Cryptographer* cryptographer, |
- base::DictionaryValue* dictionary_value, |
- int field_key_min, int field_key_max) { |
+void SetEncryptableProtoValues(const EntryKernel& kernel, |
+ Cryptographer* cryptographer, |
+ base::DictionaryValue* dictionary_value, |
+ int field_key_min, |
+ int field_key_max) { |
DCHECK_LE(field_key_min, field_key_max); |
for (int i = field_key_min; i <= field_key_max; ++i) { |
ProtoField field = static_cast<ProtoField>(i); |
@@ -105,8 +107,7 @@ void SetEncryptableProtoValues( |
std::unique_ptr<base::DictionaryValue> value; |
sync_pb::EntitySpecifics decrypted; |
const sync_pb::EncryptedData& encrypted = kernel.ref(field).encrypted(); |
- if (cryptographer && |
- kernel.ref(field).has_encrypted() && |
+ if (cryptographer && kernel.ref(field).has_encrypted() && |
cryptographer->CanDecrypt(encrypted) && |
cryptographer->Decrypt(encrypted, &decrypted)) { |
value = EntitySpecificsToValue(decrypted); |
@@ -161,42 +162,33 @@ base::DictionaryValue* EntryKernel::ToValue( |
kernel_info->Set("modelType", ModelTypeToValue(dataType)); |
// Int64 fields. |
- SetFieldValues(*this, kernel_info, |
- &GetMetahandleFieldString, &Int64ToValue, |
+ SetFieldValues(*this, kernel_info, &GetMetahandleFieldString, &Int64ToValue, |
INT64_FIELDS_BEGIN, META_HANDLE); |
- SetFieldValues(*this, kernel_info, |
- &GetBaseVersionString, &Int64ToValue, |
+ SetFieldValues(*this, kernel_info, &GetBaseVersionString, &Int64ToValue, |
META_HANDLE + 1, BASE_VERSION); |
- SetFieldValues(*this, kernel_info, |
- &GetInt64FieldString, &Int64ToValue, |
+ SetFieldValues(*this, kernel_info, &GetInt64FieldString, &Int64ToValue, |
BASE_VERSION + 1, INT64_FIELDS_END - 1); |
// Time fields. |
- SetFieldValues(*this, kernel_info, |
- &GetTimeFieldString, &TimeToValue, |
+ SetFieldValues(*this, kernel_info, &GetTimeFieldString, &TimeToValue, |
TIME_FIELDS_BEGIN, TIME_FIELDS_END - 1); |
// ID fields. |
- SetFieldValues(*this, kernel_info, |
- &GetIdFieldString, &IdToValue, |
+ SetFieldValues(*this, kernel_info, &GetIdFieldString, &IdToValue, |
ID_FIELDS_BEGIN, ID_FIELDS_END - 1); |
// Bit fields. |
- SetFieldValues(*this, kernel_info, |
- &GetIndexedBitFieldString, &BooleanToValue, |
+ SetFieldValues(*this, kernel_info, &GetIndexedBitFieldString, &BooleanToValue, |
BIT_FIELDS_BEGIN, INDEXED_BIT_FIELDS_END - 1); |
- SetFieldValues(*this, kernel_info, |
- &GetIsDelFieldString, &BooleanToValue, |
+ SetFieldValues(*this, kernel_info, &GetIsDelFieldString, &BooleanToValue, |
INDEXED_BIT_FIELDS_END, IS_DEL); |
- SetFieldValues(*this, kernel_info, |
- &GetBitFieldString, &BooleanToValue, |
+ SetFieldValues(*this, kernel_info, &GetBitFieldString, &BooleanToValue, |
IS_DEL + 1, BIT_FIELDS_END - 1); |
// String fields. |
{ |
// Pick out the function overload we want. |
- SetFieldValues(*this, kernel_info, |
- &GetStringFieldString, &StringToValue, |
+ SetFieldValues(*this, kernel_info, &GetStringFieldString, &StringToValue, |
STRING_FIELDS_BEGIN, STRING_FIELDS_END - 1); |
} |
@@ -205,21 +197,17 @@ base::DictionaryValue* EntryKernel::ToValue( |
PROTO_FIELDS_BEGIN, PROTO_FIELDS_END - 1); |
// UniquePosition fields |
- SetFieldValues(*this, kernel_info, |
- &GetUniquePositionFieldString, &UniquePositionToValue, |
- UNIQUE_POSITION_FIELDS_BEGIN, UNIQUE_POSITION_FIELDS_END - 1); |
+ SetFieldValues(*this, kernel_info, &GetUniquePositionFieldString, |
+ &UniquePositionToValue, UNIQUE_POSITION_FIELDS_BEGIN, |
+ UNIQUE_POSITION_FIELDS_END - 1); |
// AttachmentMetadata fields |
- SetFieldValues(*this, |
- kernel_info, |
- &GetAttachmentMetadataFieldString, |
- &AttachmentMetadataToValue, |
- ATTACHMENT_METADATA_FIELDS_BEGIN, |
+ SetFieldValues(*this, kernel_info, &GetAttachmentMetadataFieldString, |
+ &AttachmentMetadataToValue, ATTACHMENT_METADATA_FIELDS_BEGIN, |
ATTACHMENT_METADATA_FIELDS_END - 1); |
// Bit temps. |
- SetFieldValues(*this, kernel_info, |
- &GetBitTempString, &BooleanToValue, |
+ SetFieldValues(*this, kernel_info, &GetBitTempString, &BooleanToValue, |
BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); |
return kernel_info; |