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

Side by Side Diff: chrome/browser/sync/engine/syncer_proto_util.cc

Issue 6997006: iwyu: Include stringprintf.h where appropriate, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/sync/engine/syncer_proto_util.h" 5 #include "chrome/browser/sync/engine/syncer_proto_util.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/string_util.h" 8 #include "base/stringprintf.h"
9 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 9 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
10 #include "chrome/browser/sync/engine/syncer.h" 10 #include "chrome/browser/sync/engine/syncer.h"
11 #include "chrome/browser/sync/engine/syncer_types.h" 11 #include "chrome/browser/sync/engine/syncer_types.h"
12 #include "chrome/browser/sync/engine/syncer_util.h" 12 #include "chrome/browser/sync/engine/syncer_util.h"
13 #include "chrome/browser/sync/protocol/service_constants.h" 13 #include "chrome/browser/sync/protocol/service_constants.h"
14 #include "chrome/browser/sync/sessions/sync_session.h" 14 #include "chrome/browser/sync/sessions/sync_session.h"
15 #include "chrome/browser/sync/syncable/directory_manager.h" 15 #include "chrome/browser/sync/syncable/directory_manager.h"
16 #include "chrome/browser/sync/syncable/model_type.h" 16 #include "chrome/browser/sync/syncable/model_type.h"
17 #include "chrome/browser/sync/syncable/syncable-inl.h" 17 #include "chrome/browser/sync/syncable/syncable-inl.h"
18 #include "chrome/browser/sync/syncable/syncable.h" 18 #include "chrome/browser/sync/syncable/syncable.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // static 335 // static
336 const std::string& SyncerProtoUtil::NameFromCommitEntryResponse( 336 const std::string& SyncerProtoUtil::NameFromCommitEntryResponse(
337 const CommitResponse_EntryResponse& entry) { 337 const CommitResponse_EntryResponse& entry) {
338 if (entry.has_non_unique_name()) 338 if (entry.has_non_unique_name())
339 return entry.non_unique_name(); 339 return entry.non_unique_name();
340 return entry.name(); 340 return entry.name();
341 } 341 }
342 342
343 std::string SyncerProtoUtil::SyncEntityDebugString( 343 std::string SyncerProtoUtil::SyncEntityDebugString(
344 const sync_pb::SyncEntity& entry) { 344 const sync_pb::SyncEntity& entry) {
345 return StringPrintf("id: %s, parent_id: %s, " 345 return base::StringPrintf(
346 "version: %"PRId64"d, " 346 "id: %s, parent_id: %s, "
347 "mtime: %" PRId64"d (client: %" PRId64"d), " 347 "version: %"PRId64"d, "
348 "ctime: %" PRId64"d (client: %" PRId64"d), " 348 "mtime: %" PRId64"d (client: %" PRId64"d), "
349 "name: %s, sync_timestamp: %" PRId64"d, " 349 "ctime: %" PRId64"d (client: %" PRId64"d), "
350 "%s ", 350 "name: %s, sync_timestamp: %" PRId64"d, "
351 entry.id_string().c_str(), 351 "%s ",
352 entry.parent_id_string().c_str(), 352 entry.id_string().c_str(),
353 entry.version(), 353 entry.parent_id_string().c_str(),
354 entry.mtime(), ServerTimeToClientTime(entry.mtime()), 354 entry.version(),
355 entry.ctime(), ServerTimeToClientTime(entry.ctime()), 355 entry.mtime(), ServerTimeToClientTime(entry.mtime()),
356 entry.name().c_str(), entry.sync_timestamp(), 356 entry.ctime(), ServerTimeToClientTime(entry.ctime()),
357 entry.deleted() ? "deleted, ":""); 357 entry.name().c_str(), entry.sync_timestamp(),
358 entry.deleted() ? "deleted, ":"");
358 } 359 }
359 360
360 namespace { 361 namespace {
361 std::string GetUpdatesResponseString( 362 std::string GetUpdatesResponseString(
362 const sync_pb::GetUpdatesResponse& response) { 363 const sync_pb::GetUpdatesResponse& response) {
363 std::string output; 364 std::string output;
364 output.append("GetUpdatesResponse:\n"); 365 output.append("GetUpdatesResponse:\n");
365 for (int i = 0; i < response.entries_size(); i++) { 366 for (int i = 0; i < response.entries_size(); i++) {
366 output.append(SyncerProtoUtil::SyncEntityDebugString(response.entries(i))); 367 output.append(SyncerProtoUtil::SyncEntityDebugString(response.entries(i)));
367 output.append("\n"); 368 output.append("\n");
368 } 369 }
369 return output; 370 return output;
370 } 371 }
371 } // namespace 372 } // namespace
372 373
373 std::string SyncerProtoUtil::ClientToServerResponseDebugString( 374 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
374 const sync_pb::ClientToServerResponse& response) { 375 const sync_pb::ClientToServerResponse& response) {
375 // Add more handlers as needed. 376 // Add more handlers as needed.
376 std::string output; 377 std::string output;
377 if (response.has_get_updates()) 378 if (response.has_get_updates())
378 output.append(GetUpdatesResponseString(response.get_updates())); 379 output.append(GetUpdatesResponseString(response.get_updates()));
379 return output; 380 return output;
380 } 381 }
381 382
382 } // namespace browser_sync 383 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698