| 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 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class BookmarkModelAssociator | 33 class BookmarkModelAssociator |
| 34 : public PerDataTypeAssociatorInterface<BookmarkNode, int64> { | 34 : public PerDataTypeAssociatorInterface<BookmarkNode, int64> { |
| 35 public: | 35 public: |
| 36 static syncable::ModelType model_type() { return syncable::BOOKMARKS; } | 36 static syncable::ModelType model_type() { return syncable::BOOKMARKS; } |
| 37 BookmarkModelAssociator( | 37 BookmarkModelAssociator( |
| 38 BookmarkModel* bookmark_model, | 38 BookmarkModel* bookmark_model, |
| 39 sync_api::UserShare* user_share, | 39 sync_api::UserShare* user_share, |
| 40 UnrecoverableErrorHandler* unrecoverable_error_handler); | 40 UnrecoverableErrorHandler* unrecoverable_error_handler); |
| 41 virtual ~BookmarkModelAssociator(); | 41 virtual ~BookmarkModelAssociator(); |
| 42 | 42 |
| 43 // Invokes BookmarkModel::SetMobileFolderVisible() based on whether the mobile |
| 44 // node exists. |
| 45 void UpdateMobileNodeVisibility(); |
| 46 |
| 43 // AssociatorInterface implementation. | 47 // AssociatorInterface implementation. |
| 44 // | 48 // |
| 45 // AssociateModels iterates through both the sync and the browser | 49 // AssociateModels iterates through both the sync and the browser |
| 46 // bookmark model, looking for matched pairs of items. For any pairs it | 50 // bookmark model, looking for matched pairs of items. For any pairs it |
| 47 // finds, it will call AssociateSyncID. For any unmatched items, | 51 // finds, it will call AssociateSyncID. For any unmatched items, |
| 48 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new | 52 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new |
| 49 // node. After successful completion, the models should be identical and | 53 // node. After successful completion, the models should be identical and |
| 50 // corresponding. Returns true on success. On failure of this step, we | 54 // corresponding. Returns true on success. On failure of this step, we |
| 51 // should abort the sync operation and report an error to the user. | 55 // should abort the sync operation and report an error to the user. |
| 52 virtual bool AssociateModels(SyncError* error) OVERRIDE; | 56 virtual bool AssociateModels(SyncError* error) OVERRIDE; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; | 140 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; |
| 137 | 141 |
| 138 int number_of_new_sync_nodes_created_at_association_; | 142 int number_of_new_sync_nodes_created_at_association_; |
| 139 | 143 |
| 140 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); | 144 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); |
| 141 }; | 145 }; |
| 142 | 146 |
| 143 } // namespace browser_sync | 147 } // namespace browser_sync |
| 144 | 148 |
| 145 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 149 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |