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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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_proto_util.h ('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/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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 } // namespace 106 } // namespace
107 107
108 // static 108 // static
109 void SyncerProtoUtil::HandleMigrationDoneResponse( 109 void SyncerProtoUtil::HandleMigrationDoneResponse(
110 const sync_pb::ClientToServerResponse* response, 110 const sync_pb::ClientToServerResponse* response,
111 sessions::SyncSession* session) { 111 sessions::SyncSession* session) {
112 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) 112 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size())
113 << "MIGRATION_DONE but no types specified."; 113 << "MIGRATION_DONE but no types specified.";
114 syncable::ModelTypeSet to_migrate; 114 syncer::ModelTypeSet to_migrate;
115 for (int i = 0; i < response->migrated_data_type_id_size(); i++) { 115 for (int i = 0; i < response->migrated_data_type_id_size(); i++) {
116 to_migrate.Put(syncable::GetModelTypeFromSpecificsFieldNumber( 116 to_migrate.Put(syncer::GetModelTypeFromSpecificsFieldNumber(
117 response->migrated_data_type_id(i))); 117 response->migrated_data_type_id(i)));
118 } 118 }
119 // TODO(akalin): This should be a set union. 119 // TODO(akalin): This should be a set union.
120 session->mutable_status_controller()-> 120 session->mutable_status_controller()->
121 set_types_needing_local_migration(to_migrate); 121 set_types_needing_local_migration(to_migrate);
122 } 122 }
123 123
124 // static 124 // static
125 bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir, 125 bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir,
126 const ClientToServerResponse* response) { 126 const ClientToServerResponse* response) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 sync_protocol_error.error_description = error.error_description(); 296 sync_protocol_error.error_description = error.error_description();
297 sync_protocol_error.url = error.url(); 297 sync_protocol_error.url = error.url();
298 sync_protocol_error.action = ConvertClientActionPBToLocalClientAction( 298 sync_protocol_error.action = ConvertClientActionPBToLocalClientAction(
299 error.action()); 299 error.action());
300 300
301 if (error.error_data_type_ids_size() > 0) { 301 if (error.error_data_type_ids_size() > 0) {
302 // THROTTLED is currently the only error code that uses |error_data_types|. 302 // THROTTLED is currently the only error code that uses |error_data_types|.
303 DCHECK_EQ(error.error_type(), sync_pb::SyncEnums::THROTTLED); 303 DCHECK_EQ(error.error_type(), sync_pb::SyncEnums::THROTTLED);
304 for (int i = 0; i < error.error_data_type_ids_size(); ++i) { 304 for (int i = 0; i < error.error_data_type_ids_size(); ++i) {
305 sync_protocol_error.error_data_types.Put( 305 sync_protocol_error.error_data_types.Put(
306 syncable::GetModelTypeFromSpecificsFieldNumber( 306 syncer::GetModelTypeFromSpecificsFieldNumber(
307 error.error_data_type_ids(i))); 307 error.error_data_type_ids(i)));
308 } 308 }
309 } 309 }
310 310
311 return sync_protocol_error; 311 return sync_protocol_error;
312 } 312 }
313 313
314 // TODO(lipalani) : Rename these function names as per the CR for issue 7740067. 314 // TODO(lipalani) : Rename these function names as per the CR for issue 7740067.
315 syncer::SyncProtocolError ConvertLegacyErrorCodeToNewError( 315 syncer::SyncProtocolError ConvertLegacyErrorCodeToNewError(
316 const sync_pb::SyncEnums::ErrorType& error_type) { 316 const sync_pb::SyncEnums::ErrorType& error_type) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 std::string SyncerProtoUtil::ClientToServerResponseDebugString( 536 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
537 const sync_pb::ClientToServerResponse& response) { 537 const sync_pb::ClientToServerResponse& response) {
538 // Add more handlers as needed. 538 // Add more handlers as needed.
539 std::string output; 539 std::string output;
540 if (response.has_get_updates()) 540 if (response.has_get_updates())
541 output.append(GetUpdatesResponseString(response.get_updates())); 541 output.append(GetUpdatesResponseString(response.get_updates()));
542 return output; 542 return output;
543 } 543 }
544 544
545 } // namespace syncer 545 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_proto_util.h ('k') | sync/engine/syncer_proto_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698