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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // will be transferred to the new node. A node corresponding to |parent| | 126 // will be transferred to the new node. A node corresponding to |parent| |
127 // must already exist and be associated for this call to succeed. Returns | 127 // must already exist and be associated for this call to succeed. Returns |
128 // the ID of the just-created node, or if creation fails, kInvalidID. | 128 // the ID of the just-created node, or if creation fails, kInvalidID. |
129 static int64 CreateSyncNode(const BookmarkNode* parent, | 129 static int64 CreateSyncNode(const BookmarkNode* parent, |
130 BookmarkModel* model, | 130 BookmarkModel* model, |
131 int index, | 131 int index, |
132 syncer::WriteTransaction* trans, | 132 syncer::WriteTransaction* trans, |
133 BookmarkModelAssociator* associator, | 133 BookmarkModelAssociator* associator, |
134 DataTypeErrorHandler* error_handler); | 134 DataTypeErrorHandler* error_handler); |
135 | 135 |
| 136 // Update |bookmark_node|'s sync node. |
| 137 static int64 UpdateSyncNode(const BookmarkNode* bookmark_node, |
| 138 BookmarkModel* model, |
| 139 syncer::WriteTransaction* trans, |
| 140 BookmarkModelAssociator* associator, |
| 141 DataTypeErrorHandler* error_handler); |
| 142 |
136 // Update transaction version of |model| and |nodes| to |new_version| if | 143 // Update transaction version of |model| and |nodes| to |new_version| if |
137 // it's valid. | 144 // it's valid. |
138 static void UpdateTransactionVersion( | 145 static void UpdateTransactionVersion( |
139 int64 new_version, | 146 int64 new_version, |
140 BookmarkModel* model, | 147 BookmarkModel* model, |
141 const std::vector<const BookmarkNode*>& nodes); | 148 const std::vector<const BookmarkNode*>& nodes); |
142 | 149 |
143 protected: | 150 protected: |
144 virtual void StartImpl() OVERRIDE; | 151 virtual void StartImpl() OVERRIDE; |
145 | 152 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void RemoveAllSyncNodes(); | 196 void RemoveAllSyncNodes(); |
190 | 197 |
191 // Remove all children of the bookmark node with bookmark node id: | 198 // Remove all children of the bookmark node with bookmark node id: |
192 // |topmost_node_id|. | 199 // |topmost_node_id|. |
193 void RemoveAllChildNodes(syncer::WriteTransaction* trans, | 200 void RemoveAllChildNodes(syncer::WriteTransaction* trans, |
194 const int64& topmost_node_id); | 201 const int64& topmost_node_id); |
195 | 202 |
196 // Remove all the sync nodes associated with |node| and its children. | 203 // Remove all the sync nodes associated with |node| and its children. |
197 void RemoveSyncNodeHierarchy(const BookmarkNode* node); | 204 void RemoveSyncNodeHierarchy(const BookmarkNode* node); |
198 | 205 |
| 206 // Creates or updates a sync node associated with |node|. |
| 207 void CreateOrUpdateSyncNode(const BookmarkNode* node); |
| 208 |
199 // The bookmark model we are processing changes from. Non-NULL when | 209 // The bookmark model we are processing changes from. Non-NULL when |
200 // |running_| is true. | 210 // |running_| is true. |
201 BookmarkModel* bookmark_model_; | 211 BookmarkModel* bookmark_model_; |
202 | 212 |
203 Profile* profile_; | 213 Profile* profile_; |
204 | 214 |
205 // The two models should be associated according to this ModelAssociator. | 215 // The two models should be associated according to this ModelAssociator. |
206 BookmarkModelAssociator* model_associator_; | 216 BookmarkModelAssociator* model_associator_; |
207 | 217 |
208 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); | 218 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); |
209 }; | 219 }; |
210 | 220 |
211 } // namespace browser_sync | 221 } // namespace browser_sync |
212 | 222 |
213 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 223 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
OLD | NEW |