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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 int thumbnail_width, | 120 int thumbnail_width, |
121 int thumbnail_height); | 121 int thumbnail_height); |
122 | 122 |
123 // TODO(rfevang): Ideally nothing should need the underlying bookmark model. | 123 // TODO(rfevang): Ideally nothing should need the underlying bookmark model. |
124 // Remove when that is actually the case. | 124 // Remove when that is actually the case. |
125 BookmarkModel* bookmark_model() { return bookmark_model_; } | 125 BookmarkModel* bookmark_model() { return bookmark_model_; } |
126 | 126 |
127 // Returns true if the enhanced bookmark model is done loading. | 127 // Returns true if the enhanced bookmark model is done loading. |
128 bool loaded() { return loaded_; } | 128 bool loaded() { return loaded_; } |
129 | 129 |
| 130 // Returns the version string to use when setting stars.version. |
| 131 std::string GetVersionString(); |
| 132 |
130 private: | 133 private: |
131 FRIEND_TEST_ALL_PREFIXES(::EnhancedBookmarkModelTest, SetMultipleMetaInfo); | 134 FRIEND_TEST_ALL_PREFIXES(::EnhancedBookmarkModelTest, SetMultipleMetaInfo); |
132 | 135 |
133 typedef std::map<std::string, const BookmarkNode*> IdToNodeMap; | 136 typedef std::map<std::string, const BookmarkNode*> IdToNodeMap; |
134 typedef std::map<const BookmarkNode*, std::string> NodeToIdMap; | 137 typedef std::map<const BookmarkNode*, std::string> NodeToIdMap; |
135 | 138 |
136 // BaseBookmarkModelObserver: | 139 // BaseBookmarkModelObserver: |
137 virtual void BookmarkModelChanged() override; | 140 virtual void BookmarkModelChanged() override; |
138 virtual void BookmarkModelLoaded(BookmarkModel* model, | 141 virtual void BookmarkModelLoaded(BookmarkModel* model, |
139 bool ids_reassigned) override; | 142 bool ids_reassigned) override; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 void SetMetaInfo(const BookmarkNode* node, | 175 void SetMetaInfo(const BookmarkNode* node, |
173 const std::string& field, | 176 const std::string& field, |
174 const std::string& value); | 177 const std::string& value); |
175 | 178 |
176 // Helper method for setting multiple meta info fields at once. All the fields | 179 // Helper method for setting multiple meta info fields at once. All the fields |
177 // in |meta_info| will be set, but the method will not delete fields not | 180 // in |meta_info| will be set, but the method will not delete fields not |
178 // present. | 181 // present. |
179 void SetMultipleMetaInfo(const BookmarkNode* node, | 182 void SetMultipleMetaInfo(const BookmarkNode* node, |
180 BookmarkNode::MetaInfoMap meta_info); | 183 BookmarkNode::MetaInfoMap meta_info); |
181 | 184 |
182 // Returns the version string to use when setting stars.version. | |
183 std::string GetVersionString(); | |
184 | |
185 BookmarkModel* bookmark_model_; | 185 BookmarkModel* bookmark_model_; |
186 bool loaded_; | 186 bool loaded_; |
187 | 187 |
188 ObserverList<EnhancedBookmarkModelObserver> observers_; | 188 ObserverList<EnhancedBookmarkModelObserver> observers_; |
189 | 189 |
190 base::WeakPtrFactory<EnhancedBookmarkModel> weak_ptr_factory_; | 190 base::WeakPtrFactory<EnhancedBookmarkModel> weak_ptr_factory_; |
191 | 191 |
192 IdToNodeMap id_map_; | 192 IdToNodeMap id_map_; |
193 NodeToIdMap nodes_to_reset_; | 193 NodeToIdMap nodes_to_reset_; |
194 | 194 |
195 // Caches the remote id of a node before its meta info changes. | 195 // Caches the remote id of a node before its meta info changes. |
196 std::string prev_remote_id_; | 196 std::string prev_remote_id_; |
197 | 197 |
198 std::string version_; | 198 std::string version_; |
199 std::string version_suffix_; | 199 std::string version_suffix_; |
200 }; | 200 }; |
201 | 201 |
202 } // namespace enhanced_bookmarks | 202 } // namespace enhanced_bookmarks |
203 | 203 |
204 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 204 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
OLD | NEW |