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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // will be transferred to the new node. A node corresponding to |parent| | 107 // will be transferred to the new node. A node corresponding to |parent| |
108 // must already exist and be associated for this call to succeed. Returns | 108 // must already exist and be associated for this call to succeed. Returns |
109 // the ID of the just-created node, or if creation fails, kInvalidID. | 109 // the ID of the just-created node, or if creation fails, kInvalidID. |
110 static int64 CreateSyncNode(const BookmarkNode* parent, | 110 static int64 CreateSyncNode(const BookmarkNode* parent, |
111 BookmarkModel* model, | 111 BookmarkModel* model, |
112 int index, | 112 int index, |
113 syncer::WriteTransaction* trans, | 113 syncer::WriteTransaction* trans, |
114 BookmarkModelAssociator* associator, | 114 BookmarkModelAssociator* associator, |
115 DataTypeErrorHandler* error_handler); | 115 DataTypeErrorHandler* error_handler); |
116 | 116 |
| 117 // Update transaction version of |model| and |nodes| to |new_version| if |
| 118 // it's valid. |
| 119 static void UpdateTransactionVersion( |
| 120 int64 new_version, |
| 121 BookmarkModel* model, |
| 122 const std::vector<const BookmarkNode*>& nodes); |
| 123 |
117 protected: | 124 protected: |
118 virtual void StartImpl(Profile* profile) OVERRIDE; | 125 virtual void StartImpl(Profile* profile) OVERRIDE; |
119 | 126 |
120 private: | 127 private: |
121 enum MoveOrCreate { | 128 enum MoveOrCreate { |
122 MOVE, | 129 MOVE, |
123 CREATE, | 130 CREATE, |
124 }; | 131 }; |
125 | 132 |
126 // Helper function to determine the appropriate insertion index of sync node | 133 // Helper function to determine the appropriate insertion index of sync node |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 179 |
173 // The two models should be associated according to this ModelAssociator. | 180 // The two models should be associated according to this ModelAssociator. |
174 BookmarkModelAssociator* model_associator_; | 181 BookmarkModelAssociator* model_associator_; |
175 | 182 |
176 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); | 183 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); |
177 }; | 184 }; |
178 | 185 |
179 } // namespace browser_sync | 186 } // namespace browser_sync |
180 | 187 |
181 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 188 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
OLD | NEW |