OLD | NEW |
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/syncer_proto_util.h" | 5 #include "sync/engine/syncer_proto_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "sync/engine/net/server_connection_manager.h" | 9 #include "sync/engine/net/server_connection_manager.h" |
10 #include "sync/engine/syncer.h" | 10 #include "sync/engine/syncer.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 // static | 341 // static |
342 SyncerError SyncerProtoUtil::PostClientToServerMessage( | 342 SyncerError SyncerProtoUtil::PostClientToServerMessage( |
343 const ClientToServerMessage& msg, | 343 const ClientToServerMessage& msg, |
344 ClientToServerResponse* response, | 344 ClientToServerResponse* response, |
345 SyncSession* session) { | 345 SyncSession* session) { |
346 | 346 |
347 CHECK(response); | 347 CHECK(response); |
348 DCHECK(!msg.get_updates().has_from_timestamp()); // Deprecated. | 348 DCHECK(!msg.get_updates().has_from_timestamp()); // Deprecated. |
349 DCHECK(!msg.get_updates().has_requested_types()); // Deprecated. | 349 DCHECK(!msg.get_updates().has_requested_types()); // Deprecated. |
350 DCHECK(msg.has_store_birthday() || IsVeryFirstGetUpdates(msg)) | 350 DCHECK(msg.has_store_birthday() || |
| 351 IsVeryFirstGetUpdates(msg) || |
| 352 msg.has_get_encryption_key()) |
351 << "Must call AddRequestBirthday to set birthday."; | 353 << "Must call AddRequestBirthday to set birthday."; |
352 | 354 |
353 syncable::Directory* dir = session->context()->directory(); | 355 syncable::Directory* dir = session->context()->directory(); |
354 | 356 |
355 LogClientToServerMessage(msg); | 357 LogClientToServerMessage(msg); |
356 session->context()->traffic_recorder()->RecordClientToServerMessage(msg); | 358 session->context()->traffic_recorder()->RecordClientToServerMessage(msg); |
357 if (!PostAndProcessHeaders(session->context()->connection_manager(), session, | 359 if (!PostAndProcessHeaders(session->context()->connection_manager(), session, |
358 msg, response)) { | 360 msg, response)) { |
359 // There was an error establishing communication with the server. | 361 // There was an error establishing communication with the server. |
360 // We can not proceed beyond this point. | 362 // We can not proceed beyond this point. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 std::string SyncerProtoUtil::ClientToServerResponseDebugString( | 549 std::string SyncerProtoUtil::ClientToServerResponseDebugString( |
548 const ClientToServerResponse& response) { | 550 const ClientToServerResponse& response) { |
549 // Add more handlers as needed. | 551 // Add more handlers as needed. |
550 std::string output; | 552 std::string output; |
551 if (response.has_get_updates()) | 553 if (response.has_get_updates()) |
552 output.append(GetUpdatesResponseString(response.get_updates())); | 554 output.append(GetUpdatesResponseString(response.get_updates())); |
553 return output; | 555 return output; |
554 } | 556 } |
555 | 557 |
556 } // namespace syncer | 558 } // namespace syncer |
OLD | NEW |