| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 13 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
| 14 #include "chrome/browser/sync/engine/syncer_util.h" | 14 #include "chrome/browser/sync/engine/syncer_util.h" |
| 15 #include "chrome/browser/sync/engine/syncproto.h" | 15 #include "chrome/browser/sync/engine/syncproto.h" |
| 16 #include "chrome/browser/sync/sessions/sync_session.h" | 16 #include "chrome/browser/sync/sessions/sync_session.h" |
| 17 #include "chrome/browser/sync/syncable/directory_manager.h" | 17 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 18 #include "chrome/browser/sync/syncable/syncable.h" | 18 #include "chrome/browser/sync/syncable/syncable.h" |
| 19 #include "chrome/browser/sync/util/time.h" | |
| 20 | 19 |
| 21 using syncable::ScopedDirLookup; | 20 using syncable::ScopedDirLookup; |
| 22 using syncable::WriteTransaction; | 21 using syncable::WriteTransaction; |
| 23 using syncable::MutableEntry; | 22 using syncable::MutableEntry; |
| 24 using syncable::Entry; | 23 using syncable::Entry; |
| 25 | 24 |
| 26 using std::set; | 25 using std::set; |
| 27 using std::string; | 26 using std::string; |
| 28 using std::vector; | 27 using std::vector; |
| 29 | 28 |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // Don't clobber any other fields of deleted objects. | 373 // Don't clobber any other fields of deleted objects. |
| 375 return; | 374 return; |
| 376 } | 375 } |
| 377 | 376 |
| 378 local_entry->Put(syncable::SERVER_IS_DIR, | 377 local_entry->Put(syncable::SERVER_IS_DIR, |
| 379 (committed_entry.folder() || | 378 (committed_entry.folder() || |
| 380 committed_entry.bookmarkdata().bookmark_folder())); | 379 committed_entry.bookmarkdata().bookmark_folder())); |
| 381 local_entry->Put(syncable::SERVER_SPECIFICS, | 380 local_entry->Put(syncable::SERVER_SPECIFICS, |
| 382 committed_entry.specifics()); | 381 committed_entry.specifics()); |
| 383 local_entry->Put(syncable::SERVER_MTIME, | 382 local_entry->Put(syncable::SERVER_MTIME, |
| 384 ProtoTimeToTime(committed_entry.mtime())); | 383 committed_entry.mtime()); |
| 385 local_entry->Put(syncable::SERVER_CTIME, | 384 local_entry->Put(syncable::SERVER_CTIME, |
| 386 ProtoTimeToTime(committed_entry.ctime())); | 385 committed_entry.ctime()); |
| 387 local_entry->Put(syncable::SERVER_POSITION_IN_PARENT, | 386 local_entry->Put(syncable::SERVER_POSITION_IN_PARENT, |
| 388 entry_response.position_in_parent()); | 387 entry_response.position_in_parent()); |
| 389 // TODO(nick): The server doesn't set entry_response.server_parent_id in | 388 // TODO(nick): The server doesn't set entry_response.server_parent_id in |
| 390 // practice; to update SERVER_PARENT_ID appropriately here we'd need to | 389 // practice; to update SERVER_PARENT_ID appropriately here we'd need to |
| 391 // get the post-commit ID of the parent indicated by | 390 // get the post-commit ID of the parent indicated by |
| 392 // committed_entry.parent_id_string(). That should be inferrable from the | 391 // committed_entry.parent_id_string(). That should be inferrable from the |
| 393 // information we have, but it's a bit convoluted to pull it out directly. | 392 // information we have, but it's a bit convoluted to pull it out directly. |
| 394 // Getting this right is important: SERVER_PARENT_ID gets fed back into | 393 // Getting this right is important: SERVER_PARENT_ID gets fed back into |
| 395 // old_parent_id during the next commit. | 394 // old_parent_id during the next commit. |
| 396 local_entry->Put(syncable::SERVER_PARENT_ID, | 395 local_entry->Put(syncable::SERVER_PARENT_ID, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // been recursively deleted. | 482 // been recursively deleted. |
| 484 // TODO(nick): Here, commit_message.deleted() would be more correct than | 483 // TODO(nick): Here, commit_message.deleted() would be more correct than |
| 485 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then | 484 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then |
| 486 // deleted during the commit of the rename. Unit test & fix. | 485 // deleted during the commit of the rename. Unit test & fix. |
| 487 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { | 486 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { |
| 488 deleted_folders->insert(local_entry->Get(ID)); | 487 deleted_folders->insert(local_entry->Get(ID)); |
| 489 } | 488 } |
| 490 } | 489 } |
| 491 | 490 |
| 492 } // namespace browser_sync | 491 } // namespace browser_sync |
| OLD | NEW |