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 #include <utility> |
9 | 9 |
10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void SetEncryptableProtoValues( | 95 void SetEncryptableProtoValues( |
96 const EntryKernel& kernel, | 96 const EntryKernel& kernel, |
97 Cryptographer* cryptographer, | 97 Cryptographer* cryptographer, |
98 base::DictionaryValue* dictionary_value, | 98 base::DictionaryValue* dictionary_value, |
99 int field_key_min, int field_key_max) { | 99 int field_key_min, int field_key_max) { |
100 DCHECK_LE(field_key_min, field_key_max); | 100 DCHECK_LE(field_key_min, field_key_max); |
101 for (int i = field_key_min; i <= field_key_max; ++i) { | 101 for (int i = field_key_min; i <= field_key_max; ++i) { |
102 ProtoField field = static_cast<ProtoField>(i); | 102 ProtoField field = static_cast<ProtoField>(i); |
103 const std::string& key = GetProtoFieldString(field); | 103 const std::string& key = GetProtoFieldString(field); |
104 | 104 |
105 scoped_ptr<base::DictionaryValue> value; | 105 std::unique_ptr<base::DictionaryValue> value; |
106 sync_pb::EntitySpecifics decrypted; | 106 sync_pb::EntitySpecifics decrypted; |
107 const sync_pb::EncryptedData& encrypted = kernel.ref(field).encrypted(); | 107 const sync_pb::EncryptedData& encrypted = kernel.ref(field).encrypted(); |
108 if (cryptographer && | 108 if (cryptographer && |
109 kernel.ref(field).has_encrypted() && | 109 kernel.ref(field).has_encrypted() && |
110 cryptographer->CanDecrypt(encrypted) && | 110 cryptographer->CanDecrypt(encrypted) && |
111 cryptographer->Decrypt(encrypted, &decrypted)) { | 111 cryptographer->Decrypt(encrypted, &decrypted)) { |
112 value = EntitySpecificsToValue(decrypted); | 112 value = EntitySpecificsToValue(decrypted); |
113 value->SetBoolean("encrypted", true); | 113 value->SetBoolean("encrypted", true); |
114 } else { | 114 } else { |
115 value = EntitySpecificsToValue(kernel.ref(field)); | 115 value = EntitySpecificsToValue(kernel.ref(field)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 os << "TempFlags: "; | 287 os << "TempFlags: "; |
288 for (; i < BIT_TEMPS_END; ++i) { | 288 for (; i < BIT_TEMPS_END; ++i) { |
289 if (kernel->ref(static_cast<BitTemp>(i))) | 289 if (kernel->ref(static_cast<BitTemp>(i))) |
290 os << "#" << i - BIT_TEMPS_BEGIN << ", "; | 290 os << "#" << i - BIT_TEMPS_BEGIN << ", "; |
291 } | 291 } |
292 return os; | 292 return os; |
293 } | 293 } |
294 | 294 |
295 } // namespace syncable | 295 } // namespace syncable |
296 } // namespace syncer | 296 } // namespace syncer |
OLD | NEW |