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

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

Issue 152013003: Split up SyncEngineEventListener callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more forward declaration Created 6 years, 10 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/syncer.cc ('k') | sync/engine/syncer_proto_util_unittest.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/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/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "google_apis/google_api_keys.h" 9 #include "google_apis/google_api_keys.h"
10 #include "sync/engine/net/server_connection_manager.h" 10 #include "sync/engine/net/server_connection_manager.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 sync_protocol_error.action = DISABLE_SYNC_ON_CLIENT; 391 sync_protocol_error.action = DISABLE_SYNC_ON_CLIENT;
392 } else if (response->has_error()) { 392 } else if (response->has_error()) {
393 // This is a new server. Just get the error from the protocol. 393 // This is a new server. Just get the error from the protocol.
394 sync_protocol_error = ConvertErrorPBToLocalType(response->error()); 394 sync_protocol_error = ConvertErrorPBToLocalType(response->error());
395 } else { 395 } else {
396 // Legacy server implementation. Compute the error based on |error_code|. 396 // Legacy server implementation. Compute the error based on |error_code|.
397 sync_protocol_error = ConvertLegacyErrorCodeToNewError( 397 sync_protocol_error = ConvertLegacyErrorCodeToNewError(
398 response->error_code()); 398 response->error_code());
399 } 399 }
400 400
401 // Now set the error into the status so the layers above us could read it.
402 sessions::StatusController* status = session->mutable_status_controller();
403 status->set_sync_protocol_error(sync_protocol_error);
404
405 // Inform the delegate of the error we got. 401 // Inform the delegate of the error we got.
406 session->delegate()->OnSyncProtocolError(session->TakeSnapshot()); 402 session->delegate()->OnSyncProtocolError(sync_protocol_error);
407 403
408 // Update our state for any other commands we've received. 404 // Update our state for any other commands we've received.
409 if (response->has_client_command()) { 405 if (response->has_client_command()) {
410 const sync_pb::ClientCommand& command = response->client_command(); 406 const sync_pb::ClientCommand& command = response->client_command();
411 if (command.has_max_commit_batch_size()) { 407 if (command.has_max_commit_batch_size()) {
412 session->context()->set_max_commit_batch_size( 408 session->context()->set_max_commit_batch_size(
413 command.max_commit_batch_size()); 409 command.max_commit_batch_size());
414 } 410 }
415 411
416 if (command.has_set_sync_long_poll_interval()) { 412 if (command.has_set_sync_long_poll_interval()) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 std::string SyncerProtoUtil::ClientToServerResponseDebugString( 574 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
579 const ClientToServerResponse& response) { 575 const ClientToServerResponse& response) {
580 // Add more handlers as needed. 576 // Add more handlers as needed.
581 std::string output; 577 std::string output;
582 if (response.has_get_updates()) 578 if (response.has_get_updates())
583 output.append(GetUpdatesResponseString(response.get_updates())); 579 output.append(GetUpdatesResponseString(response.get_updates()));
584 return output; 580 return output;
585 } 581 }
586 582
587 } // namespace syncer 583 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer.cc ('k') | sync/engine/syncer_proto_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698