| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/process_commit_response_command.h" | 5 #include "chrome/browser/sync/engine/process_commit_response_command.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 12 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
| 12 #include "chrome/browser/sync/engine/syncer_util.h" | 13 #include "chrome/browser/sync/engine/syncer_util.h" |
| 13 #include "chrome/browser/sync/engine/syncproto.h" | 14 #include "chrome/browser/sync/engine/syncproto.h" |
| 14 #include "chrome/browser/sync/sessions/sync_session.h" | 15 #include "chrome/browser/sync/sessions/sync_session.h" |
| 15 #include "chrome/browser/sync/syncable/directory_manager.h" | 16 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 16 #include "chrome/browser/sync/syncable/syncable.h" | 17 #include "chrome/browser/sync/syncable/syncable.h" |
| 17 | 18 |
| 18 using syncable::ScopedDirLookup; | 19 using syncable::ScopedDirLookup; |
| 19 using syncable::WriteTransaction; | 20 using syncable::WriteTransaction; |
| 20 using syncable::MutableEntry; | 21 using syncable::MutableEntry; |
| 21 using syncable::Entry; | 22 using syncable::Entry; |
| 22 | 23 |
| 23 using std::set; | 24 using std::set; |
| 25 using std::string; |
| 24 using std::vector; | 26 using std::vector; |
| 25 | 27 |
| 26 using syncable::BASE_VERSION; | 28 using syncable::BASE_VERSION; |
| 27 using syncable::GET_BY_ID; | 29 using syncable::GET_BY_ID; |
| 28 using syncable::ID; | 30 using syncable::ID; |
| 29 using syncable::IS_DEL; | 31 using syncable::IS_DEL; |
| 30 using syncable::IS_DIR; | 32 using syncable::IS_DIR; |
| 31 using syncable::IS_UNAPPLIED_UPDATE; | 33 using syncable::IS_UNAPPLIED_UPDATE; |
| 32 using syncable::IS_UNSYNCED; | 34 using syncable::IS_UNSYNCED; |
| 33 using syncable::PARENT_ID; | 35 using syncable::PARENT_ID; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 338 } |
| 337 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { | 339 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { |
| 338 deleted_folders->insert(local_entry->Get(ID)); | 340 deleted_folders->insert(local_entry->Get(ID)); |
| 339 } | 341 } |
| 340 } | 342 } |
| 341 | 343 |
| 342 void ProcessCommitResponseCommand::PerformCommitTimeNameAside( | 344 void ProcessCommitResponseCommand::PerformCommitTimeNameAside( |
| 343 syncable::WriteTransaction* trans, | 345 syncable::WriteTransaction* trans, |
| 344 const CommitResponse_EntryResponse& server_entry, | 346 const CommitResponse_EntryResponse& server_entry, |
| 345 syncable::MutableEntry* local_entry) { | 347 syncable::MutableEntry* local_entry) { |
| 346 PathString old_name = local_entry->Get(syncable::NON_UNIQUE_NAME); | 348 string old_name = local_entry->Get(syncable::NON_UNIQUE_NAME); |
| 347 const string server_name = | 349 const string server_name = |
| 348 SyncerProtoUtil::NameFromCommitEntryResponse(server_entry); | 350 SyncerProtoUtil::NameFromCommitEntryResponse(server_entry); |
| 349 | 351 |
| 350 if (!server_name.empty() && old_name != server_name) { | 352 if (!server_name.empty() && old_name != server_name) { |
| 351 LOG(INFO) << "Server commit moved aside entry: " << old_name | 353 LOG(INFO) << "Server commit moved aside entry: " << old_name |
| 352 << " to new name " << server_name; | 354 << " to new name " << server_name; |
| 353 // Should be safe since we're in a "commit lock." | 355 // Should be safe since we're in a "commit lock." |
| 354 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name); | 356 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name); |
| 355 } | 357 } |
| 356 } | 358 } |
| 357 | 359 |
| 358 } // namespace browser_sync | 360 } // namespace browser_sync |
| OLD | NEW |