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

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

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « sync/engine/model_safe_worker.cc ('k') | sync/js/js_arg_list.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 (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/engine/nigori_util.h" 5 #include "sync/engine/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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) && 172 if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) &&
173 !was_encrypted) || 173 !was_encrypted) ||
174 !cryptographer->is_initialized()) { 174 !cryptographer->is_initialized()) {
175 // No encryption required or we are unable to encrypt. 175 // No encryption required or we are unable to encrypt.
176 generated_specifics.CopyFrom(new_specifics); 176 generated_specifics.CopyFrom(new_specifics);
177 } else { 177 } else {
178 // Encrypt new_specifics into generated_specifics. 178 // Encrypt new_specifics into generated_specifics.
179 if (VLOG_IS_ON(2)) { 179 if (VLOG_IS_ON(2)) {
180 scoped_ptr<DictionaryValue> value(entry->ToValue()); 180 scoped_ptr<DictionaryValue> value(entry->ToValue());
181 std::string info; 181 std::string info;
182 base::JSONWriter::Write(value.get(), true, &info); 182 base::JSONWriter::WriteWithOptions(value.get(),
183 base::JSONWriter::OPTIONS_PRETTY_PRINT,
184 &info);
183 DVLOG(2) << "Encrypting specifics of type " 185 DVLOG(2) << "Encrypting specifics of type "
184 << syncable::ModelTypeToString(type) 186 << syncable::ModelTypeToString(type)
185 << " with content: " 187 << " with content: "
186 << info; 188 << info;
187 } 189 }
188 // Only copy over the old specifics if it is of the right type and already 190 // 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 191 // encrypted. The first time we encrypt a node we start from scratch, hence
190 // removing all the unencrypted data, but from then on we only want to 192 // removing all the unencrypted data, but from then on we only want to
191 // update the node if the data changes or the encryption key changes. 193 // update the node if the data changes or the encryption key changes.
192 if (syncable::GetModelTypeFromSpecifics(old_specifics) == type && 194 if (syncable::GetModelTypeFromSpecifics(old_specifics) == type &&
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 237 }
236 entry->Put(syncable::SPECIFICS, generated_specifics); 238 entry->Put(syncable::SPECIFICS, generated_specifics);
237 DVLOG(1) << "Overwriting specifics of type " 239 DVLOG(1) << "Overwriting specifics of type "
238 << syncable::ModelTypeToString(type) 240 << syncable::ModelTypeToString(type)
239 << " and marking for syncing."; 241 << " and marking for syncing.";
240 syncable::MarkForSyncing(entry); 242 syncable::MarkForSyncing(entry);
241 return true; 243 return true;
242 } 244 }
243 245
244 } // namespace syncable 246 } // namespace syncable
OLDNEW
« no previous file with comments | « sync/engine/model_safe_worker.cc ('k') | sync/js/js_arg_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698