OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/sync_bookmarks/bookmark_model_associator.h" | 5 #include "components/sync_bookmarks/bookmark_model_associator.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
10 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
11 #include "base/location.h" | 13 #include "base/location.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
14 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // these change should not be undoable and so suspend the undo tracking. | 449 // these change should not be undoable and so suspend the undo tracking. |
448 ScopedSuspendBookmarkUndo suspend_undo( | 450 ScopedSuspendBookmarkUndo suspend_undo( |
449 sync_client_->GetBookmarkUndoServiceIfExists()); | 451 sync_client_->GetBookmarkUndoServiceIfExists()); |
450 | 452 |
451 Context context(local_merge_result, syncer_merge_result); | 453 Context context(local_merge_result, syncer_merge_result); |
452 | 454 |
453 syncer::SyncError error = CheckModelSyncState(&context); | 455 syncer::SyncError error = CheckModelSyncState(&context); |
454 if (error.IsSet()) | 456 if (error.IsSet()) |
455 return error; | 457 return error; |
456 | 458 |
457 scoped_ptr<ScopedAssociationUpdater> association_updater( | 459 std::unique_ptr<ScopedAssociationUpdater> association_updater( |
458 new ScopedAssociationUpdater(bookmark_model_)); | 460 new ScopedAssociationUpdater(bookmark_model_)); |
459 DisassociateModels(); | 461 DisassociateModels(); |
460 | 462 |
461 error = BuildAssociations(&context); | 463 error = BuildAssociations(&context); |
462 if (error.IsSet()) { | 464 if (error.IsSet()) { |
463 // Clear version on bookmark model so that the conservative association | 465 // Clear version on bookmark model so that the conservative association |
464 // algorithm is used on the next association. | 466 // algorithm is used on the next association. |
465 bookmark_model_->SetNodeSyncTransactionVersion( | 467 bookmark_model_->SetNodeSyncTransactionVersion( |
466 bookmark_model_->root_node(), | 468 bookmark_model_->root_node(), |
467 syncer::syncable::kInvalidTransactionVersion); | 469 syncer::syncable::kInvalidTransactionVersion); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 syncer::BOOKMARKS); | 1009 syncer::BOOKMARKS); |
1008 } else { | 1010 } else { |
1009 context->set_native_model_sync_state(BEHIND); | 1011 context->set_native_model_sync_state(BEHIND); |
1010 } | 1012 } |
1011 } | 1013 } |
1012 } | 1014 } |
1013 return syncer::SyncError(); | 1015 return syncer::SyncError(); |
1014 } | 1016 } |
1015 | 1017 |
1016 } // namespace browser_sync | 1018 } // namespace browser_sync |
OLD | NEW |