| 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 | 43 // Updates the visibility of the permanents node in the BookmarkModel. |
| 44 // node exists. | 44 void UpdatePermanentNodeVisibility(); |
| 45 void UpdateMobileNodeVisibility(); | |
| 46 | 45 |
| 47 // AssociatorInterface implementation. | 46 // AssociatorInterface implementation. |
| 48 // | 47 // |
| 49 // AssociateModels iterates through both the sync and the browser | 48 // AssociateModels iterates through both the sync and the browser |
| 50 // bookmark model, looking for matched pairs of items. For any pairs it | 49 // bookmark model, looking for matched pairs of items. For any pairs it |
| 51 // finds, it will call AssociateSyncID. For any unmatched items, | 50 // finds, it will call AssociateSyncID. For any unmatched items, |
| 52 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new | 51 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new |
| 53 // node. After successful completion, the models should be identical and | 52 // node. After successful completion, the models should be identical and |
| 54 // corresponding. Returns true on success. On failure of this step, we | 53 // corresponding. Returns true on success. On failure of this step, we |
| 55 // should abort the sync operation and report an error to the user. | 54 // should abort the sync operation and report an error to the user. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; | 139 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; |
| 141 | 140 |
| 142 int number_of_new_sync_nodes_created_at_association_; | 141 int number_of_new_sync_nodes_created_at_association_; |
| 143 | 142 |
| 144 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); | 143 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 } // namespace browser_sync | 146 } // namespace browser_sync |
| 148 | 147 |
| 149 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 148 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |