Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: sync/syncable/nigori_util.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/js/js_event_details.cc ('k') | sync/test/fake_server/fake_server_verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) && 168 if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) &&
169 !was_encrypted) || 169 !was_encrypted) ||
170 !cryptographer || !cryptographer->is_initialized()) { 170 !cryptographer || !cryptographer->is_initialized()) {
171 // No encryption required or we are unable to encrypt. 171 // No encryption required or we are unable to encrypt.
172 generated_specifics.CopyFrom(new_specifics); 172 generated_specifics.CopyFrom(new_specifics);
173 } else { 173 } else {
174 // Encrypt new_specifics into generated_specifics. 174 // Encrypt new_specifics into generated_specifics.
175 if (VLOG_IS_ON(2)) { 175 if (VLOG_IS_ON(2)) {
176 scoped_ptr<base::DictionaryValue> value(entry->ToValue(NULL)); 176 scoped_ptr<base::DictionaryValue> value(entry->ToValue(NULL));
177 std::string info; 177 std::string info;
178 base::JSONWriter::WriteWithOptions(value.get(), 178 base::JSONWriter::WriteWithOptions(
179 base::JSONWriter::OPTIONS_PRETTY_PRINT, 179 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &info);
180 &info);
181 DVLOG(2) << "Encrypting specifics of type " 180 DVLOG(2) << "Encrypting specifics of type "
182 << ModelTypeToString(type) 181 << ModelTypeToString(type)
183 << " with content: " 182 << " with content: "
184 << info; 183 << info;
185 } 184 }
186 // Only copy over the old specifics if it is of the right type and already 185 // Only copy over the old specifics if it is of the right type and already
187 // encrypted. The first time we encrypt a node we start from scratch, hence 186 // encrypted. The first time we encrypt a node we start from scratch, hence
188 // removing all the unencrypted data, but from then on we only want to 187 // removing all the unencrypted data, but from then on we only want to
189 // update the node if the data changes or the encryption key changes. 188 // update the node if the data changes or the encryption key changes.
190 if (GetModelTypeFromSpecifics(old_specifics) == type && 189 if (GetModelTypeFromSpecifics(old_specifics) == type &&
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 encrypted_types.Put(FAVICON_TRACKING); 313 encrypted_types.Put(FAVICON_TRACKING);
315 if (nigori.encrypt_articles()) 314 if (nigori.encrypt_articles())
316 encrypted_types.Put(ARTICLES); 315 encrypted_types.Put(ARTICLES);
317 if (nigori.encrypt_app_list()) 316 if (nigori.encrypt_app_list())
318 encrypted_types.Put(APP_LIST); 317 encrypted_types.Put(APP_LIST);
319 return encrypted_types; 318 return encrypted_types;
320 } 319 }
321 320
322 } // namespace syncable 321 } // namespace syncable
323 } // namespace syncer 322 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/js/js_event_details.cc ('k') | sync/test/fake_server/fake_server_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698