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

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: Cleanup 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) 469 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size())
466 << "MIGRATION_DONE but no types specified."; 470 << "MIGRATION_DONE but no types specified.";
467 // TODO(akalin): This should be a set union. 471 // TODO(akalin): This should be a set union.
468 session->mutable_status_controller()-> 472 session->mutable_status_controller()->
469 set_types_needing_local_migration(GetTypesToMigrate(*response)); 473 set_types_needing_local_migration(GetTypesToMigrate(*response));
470 return SERVER_RETURN_MIGRATION_DONE; 474 return SERVER_RETURN_MIGRATION_DONE;
471 case CLEAR_PENDING: 475 case CLEAR_PENDING:
472 return SERVER_RETURN_CLEAR_PENDING; 476 return SERVER_RETURN_CLEAR_PENDING;
473 case NOT_MY_BIRTHDAY: 477 case NOT_MY_BIRTHDAY:
474 return SERVER_RETURN_NOT_MY_BIRTHDAY; 478 return SERVER_RETURN_NOT_MY_BIRTHDAY;
479 case DISABLED_BY_ADMIN:
480 return SERVER_RETURN_DISABLED_BY_ADMIN;
475 default: 481 default:
476 NOTREACHED(); 482 NOTREACHED();
477 return UNSET; 483 return UNSET;
478 } 484 }
479 } 485 }
480 486
481 // static 487 // static
482 bool SyncerProtoUtil::Compare(const syncable::Entry& local_entry, 488 bool SyncerProtoUtil::Compare(const syncable::Entry& local_entry,
483 const sync_pb::SyncEntity& server_entry) { 489 const sync_pb::SyncEntity& server_entry) {
484 const std::string name = NameFromSyncEntity(server_entry); 490 const std::string name = NameFromSyncEntity(server_entry);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 std::string SyncerProtoUtil::ClientToServerResponseDebugString( 625 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
620 const ClientToServerResponse& response) { 626 const ClientToServerResponse& response) {
621 // Add more handlers as needed. 627 // Add more handlers as needed.
622 std::string output; 628 std::string output;
623 if (response.has_get_updates()) 629 if (response.has_get_updates())
624 output.append(GetUpdatesResponseString(response.get_updates())); 630 output.append(GetUpdatesResponseString(response.get_updates()));
625 return output; 631 return output;
626 } 632 }
627 633
628 } // namespace syncer 634 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698