| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 session->status_controller()->set_types_needing_local_migration(to_migrate); | 93 session->status_controller()->set_types_needing_local_migration(to_migrate); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // static | 96 // static |
| 97 bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir, | 97 bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir, |
| 98 const ClientToServerResponse* response) { | 98 const ClientToServerResponse* response) { |
| 99 | 99 |
| 100 std::string local_birthday = dir->store_birthday(); | 100 std::string local_birthday = dir->store_birthday(); |
| 101 | 101 |
| 102 if (response->error_code() == ClientToServerResponse::CLEAR_PENDING) { | 102 if (response->error_code() == ClientToServerResponse::CLEAR_PENDING || |
| 103 response->error_code() == ClientToServerResponse::NOT_MY_BIRTHDAY) { |
| 103 // Birthday verification failures result in stopping sync and deleting | 104 // Birthday verification failures result in stopping sync and deleting |
| 104 // local sync data. | 105 // local sync data. |
| 105 return false; | 106 return false; |
| 106 } | 107 } |
| 107 | 108 |
| 108 if (local_birthday.empty()) { | 109 if (local_birthday.empty()) { |
| 109 if (!response->has_store_birthday()) { | 110 if (!response->has_store_birthday()) { |
| 110 LOG(WARNING) << "Expected a birthday on first sync."; | 111 LOG(WARNING) << "Expected a birthday on first sync."; |
| 111 return false; | 112 return false; |
| 112 } | 113 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 std::string SyncerProtoUtil::ClientToServerResponseDebugString( | 375 std::string SyncerProtoUtil::ClientToServerResponseDebugString( |
| 375 const sync_pb::ClientToServerResponse& response) { | 376 const sync_pb::ClientToServerResponse& response) { |
| 376 // Add more handlers as needed. | 377 // Add more handlers as needed. |
| 377 std::string output; | 378 std::string output; |
| 378 if (response.has_get_updates()) | 379 if (response.has_get_updates()) |
| 379 output.append(GetUpdatesResponseString(response.get_updates())); | 380 output.append(GetUpdatesResponseString(response.get_updates())); |
| 380 return output; | 381 return output; |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // namespace browser_sync | 384 } // namespace browser_sync |
| OLD | NEW |