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

Side by Side Diff: sync/api/sync_data.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 | « remoting/host/video_frame_recorder_host_extension.cc ('k') | sync/engine/traffic_logger.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/api/sync_data.h" 5 #include "sync/api/sync_data.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 bool SyncData::IsLocal() const { return id_ == kInvalidId; } 150 bool SyncData::IsLocal() const { return id_ == kInvalidId; }
151 151
152 std::string SyncData::ToString() const { 152 std::string SyncData::ToString() const {
153 if (!IsValid()) 153 if (!IsValid())
154 return "<Invalid SyncData>"; 154 return "<Invalid SyncData>";
155 155
156 std::string type = ModelTypeToString(GetDataType()); 156 std::string type = ModelTypeToString(GetDataType());
157 std::string specifics; 157 std::string specifics;
158 scoped_ptr<base::DictionaryValue> value( 158 base::JSONWriter::WriteWithOptions(*EntitySpecificsToValue(GetSpecifics()),
159 EntitySpecificsToValue(GetSpecifics())); 159 base::JSONWriter::OPTIONS_PRETTY_PRINT,
160 base::JSONWriter::WriteWithOptions( 160 &specifics);
161 value.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &specifics);
162 161
163 if (IsLocal()) { 162 if (IsLocal()) {
164 SyncDataLocal sync_data_local(*this); 163 SyncDataLocal sync_data_local(*this);
165 return "{ isLocal: true, type: " + type + ", tag: " + 164 return "{ isLocal: true, type: " + type + ", tag: " +
166 sync_data_local.GetTag() + ", title: " + GetTitle() + 165 sync_data_local.GetTag() + ", title: " + GetTitle() +
167 ", specifics: " + specifics + "}"; 166 ", specifics: " + specifics + "}";
168 } 167 }
169 168
170 SyncDataRemote sync_data_remote(*this); 169 SyncDataRemote sync_data_remote(*this);
171 std::string id = base::Int64ToString(sync_data_remote.GetId()); 170 std::string id = base::Int64ToString(sync_data_remote.GetId());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return id_; 211 return id_;
213 } 212 }
214 213
215 void SyncDataRemote::GetOrDownloadAttachments( 214 void SyncDataRemote::GetOrDownloadAttachments(
216 const AttachmentIdList& attachment_ids, 215 const AttachmentIdList& attachment_ids,
217 const AttachmentService::GetOrDownloadCallback& callback) { 216 const AttachmentService::GetOrDownloadCallback& callback) {
218 attachment_service_.GetOrDownloadAttachments(attachment_ids, callback); 217 attachment_service_.GetOrDownloadAttachments(attachment_ids, callback);
219 } 218 }
220 219
221 } // namespace syncer 220 } // namespace syncer
OLDNEW
« no previous file with comments | « remoting/host/video_frame_recorder_host_extension.cc ('k') | sync/engine/traffic_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698