| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 public sync_driver::ChangeProcessor { | 36 public sync_driver::ChangeProcessor { |
| 37 public: | 37 public: |
| 38 BookmarkChangeProcessor(Profile* profile, | 38 BookmarkChangeProcessor(Profile* profile, |
| 39 BookmarkModelAssociator* model_associator, | 39 BookmarkModelAssociator* model_associator, |
| 40 sync_driver::DataTypeErrorHandler* error_handler); | 40 sync_driver::DataTypeErrorHandler* error_handler); |
| 41 virtual ~BookmarkChangeProcessor(); | 41 virtual ~BookmarkChangeProcessor(); |
| 42 | 42 |
| 43 // BookmarkModelObserver implementation. | 43 // BookmarkModelObserver implementation. |
| 44 // BookmarkModel -> sync API model change application. | 44 // BookmarkModel -> sync API model change application. |
| 45 virtual void BookmarkModelLoaded(BookmarkModel* model, | 45 virtual void BookmarkModelLoaded(BookmarkModel* model, |
| 46 bool ids_reassigned) OVERRIDE; | 46 bool ids_reassigned) override; |
| 47 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; | 47 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override; |
| 48 virtual void BookmarkNodeMoved(BookmarkModel* model, | 48 virtual void BookmarkNodeMoved(BookmarkModel* model, |
| 49 const BookmarkNode* old_parent, | 49 const BookmarkNode* old_parent, |
| 50 int old_index, | 50 int old_index, |
| 51 const BookmarkNode* new_parent, | 51 const BookmarkNode* new_parent, |
| 52 int new_index) OVERRIDE; | 52 int new_index) override; |
| 53 virtual void BookmarkNodeAdded(BookmarkModel* model, | 53 virtual void BookmarkNodeAdded(BookmarkModel* model, |
| 54 const BookmarkNode* parent, | 54 const BookmarkNode* parent, |
| 55 int index) OVERRIDE; | 55 int index) override; |
| 56 virtual void BookmarkNodeRemoved(BookmarkModel* model, | 56 virtual void BookmarkNodeRemoved(BookmarkModel* model, |
| 57 const BookmarkNode* parent, | 57 const BookmarkNode* parent, |
| 58 int index, | 58 int index, |
| 59 const BookmarkNode* node, | 59 const BookmarkNode* node, |
| 60 const std::set<GURL>& removed_urls) OVERRIDE; | 60 const std::set<GURL>& removed_urls) override; |
| 61 virtual void BookmarkAllUserNodesRemoved( | 61 virtual void BookmarkAllUserNodesRemoved( |
| 62 BookmarkModel* model, | 62 BookmarkModel* model, |
| 63 const std::set<GURL>& removed_urls) OVERRIDE; | 63 const std::set<GURL>& removed_urls) override; |
| 64 virtual void BookmarkNodeChanged(BookmarkModel* model, | 64 virtual void BookmarkNodeChanged(BookmarkModel* model, |
| 65 const BookmarkNode* node) OVERRIDE; | 65 const BookmarkNode* node) override; |
| 66 virtual void BookmarkMetaInfoChanged(BookmarkModel* model, | 66 virtual void BookmarkMetaInfoChanged(BookmarkModel* model, |
| 67 const BookmarkNode* node) OVERRIDE; | 67 const BookmarkNode* node) override; |
| 68 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, | 68 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, |
| 69 const BookmarkNode* node) OVERRIDE; | 69 const BookmarkNode* node) override; |
| 70 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 70 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
| 71 const BookmarkNode* node) OVERRIDE; | 71 const BookmarkNode* node) override; |
| 72 | 72 |
| 73 // The change processor implementation, responsible for applying changes from | 73 // The change processor implementation, responsible for applying changes from |
| 74 // the sync model to the bookmarks model. | 74 // the sync model to the bookmarks model. |
| 75 virtual void ApplyChangesFromSyncModel( | 75 virtual void ApplyChangesFromSyncModel( |
| 76 const syncer::BaseTransaction* trans, | 76 const syncer::BaseTransaction* trans, |
| 77 int64 model_version, | 77 int64 model_version, |
| 78 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; | 78 const syncer::ImmutableChangeRecordList& changes) override; |
| 79 | 79 |
| 80 // The following methods are static and hence may be invoked at any time, and | 80 // The following methods are static and hence may be invoked at any time, and |
| 81 // do not depend on having a running ChangeProcessor. | 81 // do not depend on having a running ChangeProcessor. |
| 82 | 82 |
| 83 // Updates the title, URL, creation time and favicon of the bookmark |node| | 83 // Updates the title, URL, creation time and favicon of the bookmark |node| |
| 84 // with data taken from the |sync_node| sync node. | 84 // with data taken from the |sync_node| sync node. |
| 85 static void UpdateBookmarkWithSyncData( | 85 static void UpdateBookmarkWithSyncData( |
| 86 const syncer::BaseNode& sync_node, | 86 const syncer::BaseNode& sync_node, |
| 87 BookmarkModel* model, | 87 BookmarkModel* model, |
| 88 const BookmarkNode* node, | 88 const BookmarkNode* node, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 sync_driver::DataTypeErrorHandler* error_handler); | 141 sync_driver::DataTypeErrorHandler* error_handler); |
| 142 | 142 |
| 143 // Update transaction version of |model| and |nodes| to |new_version| if | 143 // Update transaction version of |model| and |nodes| to |new_version| if |
| 144 // it's valid. | 144 // it's valid. |
| 145 static void UpdateTransactionVersion( | 145 static void UpdateTransactionVersion( |
| 146 int64 new_version, | 146 int64 new_version, |
| 147 BookmarkModel* model, | 147 BookmarkModel* model, |
| 148 const std::vector<const BookmarkNode*>& nodes); | 148 const std::vector<const BookmarkNode*>& nodes); |
| 149 | 149 |
| 150 protected: | 150 protected: |
| 151 virtual void StartImpl() OVERRIDE; | 151 virtual void StartImpl() override; |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 enum MoveOrCreate { | 154 enum MoveOrCreate { |
| 155 MOVE, | 155 MOVE, |
| 156 CREATE, | 156 CREATE, |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 // Retrieves the meta info from the given sync node. | 159 // Retrieves the meta info from the given sync node. |
| 160 static scoped_ptr<BookmarkNode::MetaInfoMap> GetBookmarkMetaInfo( | 160 static scoped_ptr<BookmarkNode::MetaInfoMap> GetBookmarkMetaInfo( |
| 161 const syncer::BaseNode* sync_node); | 161 const syncer::BaseNode* sync_node); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 // The two models should be associated according to this ModelAssociator. | 218 // The two models should be associated according to this ModelAssociator. |
| 219 BookmarkModelAssociator* model_associator_; | 219 BookmarkModelAssociator* model_associator_; |
| 220 | 220 |
| 221 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); | 221 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 } // namespace browser_sync | 224 } // namespace browser_sync |
| 225 | 225 |
| 226 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 226 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
| OLD | NEW |