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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "sync/protocol/proto_value_conversions.h" | 12 #include "sync/protocol/proto_value_conversions.h" |
12 #include "sync/syncable/syncable_columns.h" | 13 #include "sync/syncable/syncable_columns.h" |
13 #include "sync/syncable/syncable_enum_conversions.h" | 14 #include "sync/syncable/syncable_enum_conversions.h" |
14 #include "sync/util/cryptographer.h" | 15 #include "sync/util/cryptographer.h" |
15 | 16 |
16 namespace syncer { | 17 namespace syncer { |
17 namespace syncable { | 18 namespace syncable { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const sync_pb::EncryptedData& encrypted = kernel.ref(field).encrypted(); | 105 const sync_pb::EncryptedData& encrypted = kernel.ref(field).encrypted(); |
105 if (cryptographer && | 106 if (cryptographer && |
106 kernel.ref(field).has_encrypted() && | 107 kernel.ref(field).has_encrypted() && |
107 cryptographer->CanDecrypt(encrypted) && | 108 cryptographer->CanDecrypt(encrypted) && |
108 cryptographer->Decrypt(encrypted, &decrypted)) { | 109 cryptographer->Decrypt(encrypted, &decrypted)) { |
109 value = EntitySpecificsToValue(decrypted); | 110 value = EntitySpecificsToValue(decrypted); |
110 value->SetBoolean("encrypted", true); | 111 value->SetBoolean("encrypted", true); |
111 } else { | 112 } else { |
112 value = EntitySpecificsToValue(kernel.ref(field)); | 113 value = EntitySpecificsToValue(kernel.ref(field)); |
113 } | 114 } |
114 dictionary_value->Set(key, value.Pass()); | 115 dictionary_value->Set(key, std::move(value)); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 // Helper functions for SetFieldValues(). | 119 // Helper functions for SetFieldValues(). |
119 | 120 |
120 base::StringValue* Int64ToValue(int64_t i) { | 121 base::StringValue* Int64ToValue(int64_t i) { |
121 return new base::StringValue(base::Int64ToString(i)); | 122 return new base::StringValue(base::Int64ToString(i)); |
122 } | 123 } |
123 | 124 |
124 base::StringValue* TimeToValue(const base::Time& t) { | 125 base::StringValue* TimeToValue(const base::Time& t) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 os << "TempFlags: "; | 285 os << "TempFlags: "; |
285 for (; i < BIT_TEMPS_END; ++i) { | 286 for (; i < BIT_TEMPS_END; ++i) { |
286 if (kernel->ref(static_cast<BitTemp>(i))) | 287 if (kernel->ref(static_cast<BitTemp>(i))) |
287 os << "#" << i - BIT_TEMPS_BEGIN << ", "; | 288 os << "#" << i - BIT_TEMPS_BEGIN << ", "; |
288 } | 289 } |
289 return os; | 290 return os; |
290 } | 291 } |
291 | 292 |
292 } // namespace syncable | 293 } // namespace syncable |
293 } // namespace syncer | 294 } // namespace syncer |
OLD | NEW |