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 "chrome/browser/sync/engine/syncer_proto_util.h" | 5 #include "chrome/browser/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 "chrome/browser/sync/engine/net/server_connection_manager.h" | 9 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
10 #include "chrome/browser/sync/engine/syncer.h" | 10 #include "chrome/browser/sync/engine/syncer.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } // namespace | 104 } // namespace |
105 | 105 |
106 // static | 106 // static |
107 void SyncerProtoUtil::HandleMigrationDoneResponse( | 107 void SyncerProtoUtil::HandleMigrationDoneResponse( |
108 const sync_pb::ClientToServerResponse* response, | 108 const sync_pb::ClientToServerResponse* response, |
109 sessions::SyncSession* session) { | 109 sessions::SyncSession* session) { |
110 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) | 110 LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) |
111 << "MIGRATION_DONE but no types specified."; | 111 << "MIGRATION_DONE but no types specified."; |
112 syncable::ModelTypeSet to_migrate; | 112 syncable::ModelTypeSet to_migrate; |
113 for (int i = 0; i < response->migrated_data_type_id_size(); i++) { | 113 for (int i = 0; i < response->migrated_data_type_id_size(); i++) { |
114 to_migrate.Put(syncable::GetModelTypeFromExtensionFieldNumber( | 114 to_migrate.Put(syncable::GetModelTypeFromSpecificsFieldNumber( |
115 response->migrated_data_type_id(i))); | 115 response->migrated_data_type_id(i))); |
116 } | 116 } |
117 // TODO(akalin): This should be a set union. | 117 // TODO(akalin): This should be a set union. |
118 session->mutable_status_controller()-> | 118 session->mutable_status_controller()-> |
119 set_types_needing_local_migration(to_migrate); | 119 set_types_needing_local_migration(to_migrate); |
120 } | 120 } |
121 | 121 |
122 // static | 122 // static |
123 bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir, | 123 bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir, |
124 const ClientToServerResponse* response) { | 124 const ClientToServerResponse* response) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 sync_protocol_error.error_description = error.error_description(); | 294 sync_protocol_error.error_description = error.error_description(); |
295 sync_protocol_error.url = error.url(); | 295 sync_protocol_error.url = error.url(); |
296 sync_protocol_error.action = ConvertClientActionPBToLocalClientAction( | 296 sync_protocol_error.action = ConvertClientActionPBToLocalClientAction( |
297 error.action()); | 297 error.action()); |
298 | 298 |
299 if (error.error_data_type_ids_size() > 0) { | 299 if (error.error_data_type_ids_size() > 0) { |
300 // THROTTLED is currently the only error code that uses |error_data_types|. | 300 // THROTTLED is currently the only error code that uses |error_data_types|. |
301 DCHECK_EQ(error.error_type(), sync_pb::SyncEnums::THROTTLED); | 301 DCHECK_EQ(error.error_type(), sync_pb::SyncEnums::THROTTLED); |
302 for (int i = 0; i < error.error_data_type_ids_size(); ++i) { | 302 for (int i = 0; i < error.error_data_type_ids_size(); ++i) { |
303 sync_protocol_error.error_data_types.Put( | 303 sync_protocol_error.error_data_types.Put( |
304 syncable::GetModelTypeFromExtensionFieldNumber( | 304 syncable::GetModelTypeFromSpecificsFieldNumber( |
305 error.error_data_type_ids(i))); | 305 error.error_data_type_ids(i))); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 return sync_protocol_error; | 309 return sync_protocol_error; |
310 } | 310 } |
311 | 311 |
312 // TODO(lipalani) : Rename these function names as per the CR for issue 7740067. | 312 // TODO(lipalani) : Rename these function names as per the CR for issue 7740067. |
313 browser_sync::SyncProtocolError ConvertLegacyErrorCodeToNewError( | 313 browser_sync::SyncProtocolError ConvertLegacyErrorCodeToNewError( |
314 const sync_pb::SyncEnums::ErrorType& error_type) { | 314 const sync_pb::SyncEnums::ErrorType& error_type) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 std::string SyncerProtoUtil::ClientToServerResponseDebugString( | 528 std::string SyncerProtoUtil::ClientToServerResponseDebugString( |
529 const sync_pb::ClientToServerResponse& response) { | 529 const sync_pb::ClientToServerResponse& response) { |
530 // Add more handlers as needed. | 530 // Add more handlers as needed. |
531 std::string output; | 531 std::string output; |
532 if (response.has_get_updates()) | 532 if (response.has_get_updates()) |
533 output.append(GetUpdatesResponseString(response.get_updates())); | 533 output.append(GetUpdatesResponseString(response.get_updates())); |
534 return output; | 534 return output; |
535 } | 535 } |
536 | 536 |
537 } // namespace browser_sync | 537 } // namespace browser_sync |
OLD | NEW |