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

Side by Side Diff: sync/engine/model_safe_worker.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 | « remoting/host/json_host_config.cc ('k') | sync/engine/nigori_util.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/model_safe_worker.h" 5 #include "sync/engine/model_safe_worker.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
11 namespace browser_sync { 11 namespace browser_sync {
12 12
13 base::DictionaryValue* ModelSafeRoutingInfoToValue( 13 base::DictionaryValue* ModelSafeRoutingInfoToValue(
14 const ModelSafeRoutingInfo& routing_info) { 14 const ModelSafeRoutingInfo& routing_info) {
15 base::DictionaryValue* dict = new base::DictionaryValue(); 15 base::DictionaryValue* dict = new base::DictionaryValue();
16 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); 16 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin();
17 it != routing_info.end(); ++it) { 17 it != routing_info.end(); ++it) {
18 dict->SetString(syncable::ModelTypeToString(it->first), 18 dict->SetString(syncable::ModelTypeToString(it->first),
19 ModelSafeGroupToString(it->second)); 19 ModelSafeGroupToString(it->second));
20 } 20 }
21 return dict; 21 return dict;
22 } 22 }
23 23
24 std::string ModelSafeRoutingInfoToString( 24 std::string ModelSafeRoutingInfoToString(
25 const ModelSafeRoutingInfo& routing_info) { 25 const ModelSafeRoutingInfo& routing_info) {
26 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info)); 26 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info));
27 std::string json; 27 std::string json;
28 base::JSONWriter::Write(dict.get(), false, &json); 28 base::JSONWriter::Write(dict.get(), &json);
29 return json; 29 return json;
30 } 30 }
31 31
32 syncable::ModelTypeSet GetRoutingInfoTypes( 32 syncable::ModelTypeSet GetRoutingInfoTypes(
33 const ModelSafeRoutingInfo& routing_info) { 33 const ModelSafeRoutingInfo& routing_info) {
34 syncable::ModelTypeSet types; 34 syncable::ModelTypeSet types;
35 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); 35 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin();
36 it != routing_info.end(); ++it) { 36 it != routing_info.end(); ++it) {
37 types.Put(it->first); 37 types.Put(it->first);
38 } 38 }
(...skipping 27 matching lines...) Expand all
66 return "GROUP_PASSWORD"; 66 return "GROUP_PASSWORD";
67 default: 67 default:
68 NOTREACHED(); 68 NOTREACHED();
69 return "INVALID"; 69 return "INVALID";
70 } 70 }
71 } 71 }
72 72
73 ModelSafeWorker::~ModelSafeWorker() {} 73 ModelSafeWorker::~ModelSafeWorker() {}
74 74
75 } // namespace browser_sync 75 } // namespace browser_sync
OLDNEW
« no previous file with comments | « remoting/host/json_host_config.cc ('k') | sync/engine/nigori_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698