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 COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // All matched icon mappings are returned in descent order of IconType if | 183 // All matched icon mappings are returned in descent order of IconType if |
184 // mapping_data is not NULL. | 184 // mapping_data is not NULL. |
185 bool GetIconMappingsForPageURL(const GURL& page_url, | 185 bool GetIconMappingsForPageURL(const GURL& page_url, |
186 std::vector<IconMapping>* mapping_data); | 186 std::vector<IconMapping>* mapping_data); |
187 | 187 |
188 // Adds a mapping between the given page_url and icon_id. | 188 // Adds a mapping between the given page_url and icon_id. |
189 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. | 189 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. |
190 IconMappingID AddIconMapping(const GURL& page_url, | 190 IconMappingID AddIconMapping(const GURL& page_url, |
191 favicon_base::FaviconID icon_id); | 191 favicon_base::FaviconID icon_id); |
192 | 192 |
193 // Updates the page and icon mapping for the given mapping_id with the given | |
194 // icon_id. | |
195 // Returns true if the update succeeded. | |
196 bool UpdateIconMapping(IconMappingID mapping_id, | |
197 favicon_base::FaviconID icon_id); | |
198 | |
199 // Deletes the icon mapping entries for the given page url. | 193 // Deletes the icon mapping entries for the given page url. |
200 // Returns true if the deletion succeeded. | 194 // Returns true if the deletion succeeded. |
201 bool DeleteIconMappings(const GURL& page_url); | 195 bool DeleteIconMappings(const GURL& page_url); |
202 | 196 |
203 // Deletes the icon mapping with |mapping_id|. | 197 // Deletes the icon mapping with |mapping_id|. |
204 // Returns true if the deletion succeeded. | 198 // Returns true if the deletion succeeded. |
205 bool DeleteIconMapping(IconMappingID mapping_id); | 199 bool DeleteIconMapping(IconMappingID mapping_id); |
206 | 200 |
207 // Checks whether a favicon is used by any URLs in the database. | 201 // Checks whether a favicon is used by any URLs in the database. |
208 bool HasMappingFor(favicon_base::FaviconID id); | 202 bool HasMappingFor(favicon_base::FaviconID id); |
209 | 203 |
210 // Clones the existing mappings from |old_page_url| if |new_page_url| has no | |
211 // mappings. Otherwise, will leave mappings alone. | |
212 bool CloneIconMappings(const GURL& old_page_url, const GURL& new_page_url); | |
213 | |
214 // The class to enumerate icon mappings. Use InitIconMappingEnumerator to | 204 // The class to enumerate icon mappings. Use InitIconMappingEnumerator to |
215 // initialize. | 205 // initialize. |
216 class IconMappingEnumerator { | 206 class IconMappingEnumerator { |
217 public: | 207 public: |
218 IconMappingEnumerator(); | 208 IconMappingEnumerator(); |
219 ~IconMappingEnumerator(); | 209 ~IconMappingEnumerator(); |
220 | 210 |
221 // Get the next icon mapping, return false if no more are available. | 211 // Get the next icon mapping, return false if no more are available. |
222 bool GetNextIconMapping(IconMapping* icon_mapping); | 212 bool GetNextIconMapping(IconMapping* icon_mapping); |
223 | 213 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 269 |
280 sql::Connection db_; | 270 sql::Connection db_; |
281 sql::MetaTable meta_table_; | 271 sql::MetaTable meta_table_; |
282 | 272 |
283 HistoryClient* history_client_; | 273 HistoryClient* history_client_; |
284 }; | 274 }; |
285 | 275 |
286 } // namespace history | 276 } // namespace history |
287 | 277 |
288 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 278 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
OLD | NEW |