OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Recursively removes a node and all its children from the various maps. | 180 // Recursively removes a node and all its children from the various maps. |
181 void RemoveNodeFromMaps(const bookmarks::BookmarkNode* node); | 181 void RemoveNodeFromMaps(const bookmarks::BookmarkNode* node); |
182 | 182 |
183 // If there are nodes that needs to reset their remote ids, schedules | 183 // If there are nodes that needs to reset their remote ids, schedules |
184 // ResetDuplicateRemoteIds to be run asynchronously. | 184 // ResetDuplicateRemoteIds to be run asynchronously. |
185 void ScheduleResetDuplicateRemoteIds(); | 185 void ScheduleResetDuplicateRemoteIds(); |
186 | 186 |
187 // Clears out any duplicate remote ids detected by AddToIdMap calls. | 187 // Clears out any duplicate remote ids detected by AddToIdMap calls. |
188 void ResetDuplicateRemoteIds(); | 188 void ResetDuplicateRemoteIds(); |
189 | 189 |
190 // Sets the NEEDS_OFFLINE_PROCESSING flag on the given node. | |
191 void SetNeedsOfflineProcessing(const bookmarks::BookmarkNode* node); | |
192 | |
193 // Helper method for setting a meta info field on a node. Also updates the | 190 // Helper method for setting a meta info field on a node. Also updates the |
194 // version field. | 191 // version field. |
195 void SetMetaInfo(const bookmarks::BookmarkNode* node, | 192 void SetMetaInfo(const bookmarks::BookmarkNode* node, |
196 const std::string& field, | 193 const std::string& field, |
197 const std::string& value); | 194 const std::string& value); |
198 | 195 |
199 // Helper method for setting multiple meta info fields at once. All the fields | 196 // Helper method for setting multiple meta info fields at once. All the fields |
200 // in |meta_info| will be set, but the method will not delete fields not | 197 // in |meta_info| will be set, but the method will not delete fields not |
201 // present. | 198 // present. |
202 void SetMultipleMetaInfo(const bookmarks::BookmarkNode* node, | 199 void SetMultipleMetaInfo(const bookmarks::BookmarkNode* node, |
203 bookmarks::BookmarkNode::MetaInfoMap meta_info); | 200 bookmarks::BookmarkNode::MetaInfoMap meta_info); |
204 | 201 |
205 bookmarks::BookmarkModel* bookmark_model_; | 202 bookmarks::BookmarkModel* bookmark_model_; |
206 bool loaded_; | 203 bool loaded_; |
207 | 204 |
208 ObserverList<EnhancedBookmarkModelObserver> observers_; | 205 ObserverList<EnhancedBookmarkModelObserver> observers_; |
209 | 206 |
210 IdToNodeMap id_map_; | 207 IdToNodeMap id_map_; |
211 NodeToIdMap nodes_to_reset_; | 208 NodeToIdMap nodes_to_reset_; |
212 | 209 |
213 // Pending SetNeedsOfflineProcessing calls are stored here, as they may need | |
214 // to be cancelled if the node is removed. | |
215 std::map<const bookmarks::BookmarkNode*, linked_ptr<base::CancelableClosure>> | |
216 set_needs_offline_processing_tasks_; | |
217 | |
218 // Caches the remote id of a node before its meta info changes. | 210 // Caches the remote id of a node before its meta info changes. |
219 std::string prev_remote_id_; | 211 std::string prev_remote_id_; |
220 | 212 |
221 std::string version_; | 213 std::string version_; |
222 std::string version_suffix_; | 214 std::string version_suffix_; |
223 | 215 |
224 base::WeakPtrFactory<EnhancedBookmarkModel> weak_ptr_factory_; | 216 base::WeakPtrFactory<EnhancedBookmarkModel> weak_ptr_factory_; |
225 }; | 217 }; |
226 | 218 |
227 } // namespace enhanced_bookmarks | 219 } // namespace enhanced_bookmarks |
228 | 220 |
229 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 221 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
OLD | NEW |