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

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

Issue 14655009: Client changes for disabled dasher account (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix small things based on feedback Created 7 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
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/stringprintf.h" 8 #include "base/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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 case sync_pb::SyncEnums::NOT_MY_BIRTHDAY: 114 case sync_pb::SyncEnums::NOT_MY_BIRTHDAY:
115 return NOT_MY_BIRTHDAY; 115 return NOT_MY_BIRTHDAY;
116 case sync_pb::SyncEnums::THROTTLED: 116 case sync_pb::SyncEnums::THROTTLED:
117 return THROTTLED; 117 return THROTTLED;
118 case sync_pb::SyncEnums::CLEAR_PENDING: 118 case sync_pb::SyncEnums::CLEAR_PENDING:
119 return CLEAR_PENDING; 119 return CLEAR_PENDING;
120 case sync_pb::SyncEnums::TRANSIENT_ERROR: 120 case sync_pb::SyncEnums::TRANSIENT_ERROR:
121 return TRANSIENT_ERROR; 121 return TRANSIENT_ERROR;
122 case sync_pb::SyncEnums::MIGRATION_DONE: 122 case sync_pb::SyncEnums::MIGRATION_DONE:
123 return MIGRATION_DONE; 123 return MIGRATION_DONE;
124 case sync_pb::SyncEnums::DISABLED_BY_ADMIN:
125 return DISABLED_BY_ADMIN;
124 case sync_pb::SyncEnums::UNKNOWN: 126 case sync_pb::SyncEnums::UNKNOWN:
125 return UNKNOWN_ERROR; 127 return UNKNOWN_ERROR;
126 case sync_pb::SyncEnums::USER_NOT_ACTIVATED: 128 case sync_pb::SyncEnums::USER_NOT_ACTIVATED:
127 case sync_pb::SyncEnums::AUTH_INVALID: 129 case sync_pb::SyncEnums::AUTH_INVALID:
128 case sync_pb::SyncEnums::ACCESS_DENIED: 130 case sync_pb::SyncEnums::ACCESS_DENIED:
129 return INVALID_CREDENTIAL; 131 return INVALID_CREDENTIAL;
130 default: 132 default:
131 NOTREACHED(); 133 NOTREACHED();
132 return UNKNOWN_ERROR; 134 return UNKNOWN_ERROR;
133 } 135 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return true; 335 return true;
334 } 336 }
335 337
336 // TODO(lipalani) : Rename these function names as per the CR for issue 7740067. 338 // TODO(lipalani) : Rename these function names as per the CR for issue 7740067.
337 SyncProtocolError ConvertLegacyErrorCodeToNewError( 339 SyncProtocolError ConvertLegacyErrorCodeToNewError(
338 const sync_pb::SyncEnums::ErrorType& error_type) { 340 const sync_pb::SyncEnums::ErrorType& error_type) {
339 SyncProtocolError error; 341 SyncProtocolError error;
340 error.error_type = ConvertSyncProtocolErrorTypePBToLocalType(error_type); 342 error.error_type = ConvertSyncProtocolErrorTypePBToLocalType(error_type);
341 if (error_type == sync_pb::SyncEnums::CLEAR_PENDING || 343 if (error_type == sync_pb::SyncEnums::CLEAR_PENDING ||
342 error_type == sync_pb::SyncEnums::NOT_MY_BIRTHDAY) { 344 error_type == sync_pb::SyncEnums::NOT_MY_BIRTHDAY) {
343 error.action = DISABLE_SYNC_ON_CLIENT; 345 error.action = DISABLE_SYNC_ON_CLIENT;
346 } else if (error_type == sync_pb::SyncEnums::DISABLED_BY_ADMIN) {
347 error.action = STOP_SYNC_FOR_DISABLED_ACCOUNT;
344 } // There is no other action we can compute for legacy server. 348 } // There is no other action we can compute for legacy server.
345 return error; 349 return error;
346 } 350 }
347 351
348 } // namespace 352 } // namespace
349 353
350 // static 354 // static
351 SyncerError SyncerProtoUtil::PostClientToServerMessage( 355 SyncerError SyncerProtoUtil::PostClientToServerMessage(
352 ClientToServerMessage* msg, 356 ClientToServerMessage* msg,
353 ClientToServerResponse* response, 357 ClientToServerResponse* response,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) 464 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size())
461 << "MIGRATION_DONE but no types specified."; 465 << "MIGRATION_DONE but no types specified.";
462 // TODO(akalin): This should be a set union. 466 // TODO(akalin): This should be a set union.
463 session->mutable_status_controller()-> 467 session->mutable_status_controller()->
464 set_types_needing_local_migration(GetTypesToMigrate(*response)); 468 set_types_needing_local_migration(GetTypesToMigrate(*response));
465 return SERVER_RETURN_MIGRATION_DONE; 469 return SERVER_RETURN_MIGRATION_DONE;
466 case CLEAR_PENDING: 470 case CLEAR_PENDING:
467 return SERVER_RETURN_CLEAR_PENDING; 471 return SERVER_RETURN_CLEAR_PENDING;
468 case NOT_MY_BIRTHDAY: 472 case NOT_MY_BIRTHDAY:
469 return SERVER_RETURN_NOT_MY_BIRTHDAY; 473 return SERVER_RETURN_NOT_MY_BIRTHDAY;
474 case DISABLED_BY_ADMIN:
475 return SERVER_RETURN_DISABLED_BY_ADMIN;
470 default: 476 default:
471 NOTREACHED(); 477 NOTREACHED();
472 return UNSET; 478 return UNSET;
473 } 479 }
474 } 480 }
475 481
476 // static 482 // static
477 bool SyncerProtoUtil::Compare(const syncable::Entry& local_entry, 483 bool SyncerProtoUtil::Compare(const syncable::Entry& local_entry,
478 const sync_pb::SyncEntity& server_entry) { 484 const sync_pb::SyncEntity& server_entry) {
479 const std::string name = NameFromSyncEntity(server_entry); 485 const std::string name = NameFromSyncEntity(server_entry);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 std::string SyncerProtoUtil::ClientToServerResponseDebugString( 620 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
615 const ClientToServerResponse& response) { 621 const ClientToServerResponse& response) {
616 // Add more handlers as needed. 622 // Add more handlers as needed.
617 std::string output; 623 std::string output;
618 if (response.has_get_updates()) 624 if (response.has_get_updates())
619 output.append(GetUpdatesResponseString(response.get_updates())); 625 output.append(GetUpdatesResponseString(response.get_updates()));
620 return output; 626 return output;
621 } 627 }
622 628
623 } // namespace syncer 629 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698