OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/nigori_util.h" | 5 #include "sync/syncable/nigori_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return false; | 169 return false; |
170 } | 170 } |
171 if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) && | 171 if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) && |
172 !was_encrypted) || | 172 !was_encrypted) || |
173 !cryptographer || !cryptographer->is_initialized()) { | 173 !cryptographer || !cryptographer->is_initialized()) { |
174 // No encryption required or we are unable to encrypt. | 174 // No encryption required or we are unable to encrypt. |
175 generated_specifics.CopyFrom(new_specifics); | 175 generated_specifics.CopyFrom(new_specifics); |
176 } else { | 176 } else { |
177 // Encrypt new_specifics into generated_specifics. | 177 // Encrypt new_specifics into generated_specifics. |
178 if (VLOG_IS_ON(2)) { | 178 if (VLOG_IS_ON(2)) { |
179 scoped_ptr<base::DictionaryValue> value(entry->ToValue(NULL)); | 179 std::unique_ptr<base::DictionaryValue> value(entry->ToValue(NULL)); |
180 std::string info; | 180 std::string info; |
181 base::JSONWriter::WriteWithOptions( | 181 base::JSONWriter::WriteWithOptions( |
182 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &info); | 182 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &info); |
183 DVLOG(2) << "Encrypting specifics of type " | 183 DVLOG(2) << "Encrypting specifics of type " |
184 << ModelTypeToString(type) | 184 << ModelTypeToString(type) |
185 << " with content: " | 185 << " with content: " |
186 << info; | 186 << info; |
187 } | 187 } |
188 // Only copy over the old specifics if it is of the right type and already | 188 // Only copy over the old specifics if it is of the right type and already |
189 // encrypted. The first time we encrypt a node we start from scratch, hence | 189 // encrypted. The first time we encrypt a node we start from scratch, hence |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 encrypted_types.Put(FAVICON_TRACKING); | 320 encrypted_types.Put(FAVICON_TRACKING); |
321 if (nigori.encrypt_articles()) | 321 if (nigori.encrypt_articles()) |
322 encrypted_types.Put(ARTICLES); | 322 encrypted_types.Put(ARTICLES); |
323 if (nigori.encrypt_app_list()) | 323 if (nigori.encrypt_app_list()) |
324 encrypted_types.Put(APP_LIST); | 324 encrypted_types.Put(APP_LIST); |
325 return encrypted_types; | 325 return encrypted_types; |
326 } | 326 } |
327 | 327 |
328 } // namespace syncable | 328 } // namespace syncable |
329 } // namespace syncer | 329 } // namespace syncer |
OLD | NEW |