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_HISTORY_THUMBNAIL_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
6 #define CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // current thumbnail score and places it in |score| and returns | 92 // current thumbnail score and places it in |score| and returns |
93 // true. Returns false otherwise. | 93 // true. Returns false otherwise. |
94 bool ThumbnailScoreForId(URLID id, ThumbnailScore* score); | 94 bool ThumbnailScoreForId(URLID id, ThumbnailScore* score); |
95 | 95 |
96 // Called by the to delete all old thumbnails and make a clean table. | 96 // Called by the to delete all old thumbnails and make a clean table. |
97 // Returns true on success. | 97 // Returns true on success. |
98 bool RecreateThumbnailTable(); | 98 bool RecreateThumbnailTable(); |
99 | 99 |
100 // Favicon Bitmaps ----------------------------------------------------------- | 100 // Favicon Bitmaps ----------------------------------------------------------- |
101 | 101 |
| 102 // Returns true if there are favicon bitmaps for |icon_id|. If |
| 103 // |bitmap_size_listing| is non NULL, sets it to a listing of the favicon |
| 104 // bitmap ids and their associated pixel sizes for the favicon with |
| 105 // |icon_id|. |
| 106 bool GetFaviconBitmapIDSizes( |
| 107 FaviconID icon_id, |
| 108 std::vector<FaviconBitmapIDSize>* bitmap_id_sizes); |
| 109 |
102 // Returns true if there are any matched bitmaps for the given |icon_id|. All | 110 // Returns true if there are any matched bitmaps for the given |icon_id|. All |
103 // matched results are returned if |favicon_bitmaps| is not NULL. | 111 // matched results are returned if |favicon_bitmaps| is not NULL. |
104 bool GetFaviconBitmaps(FaviconID icon_id, | 112 bool GetFaviconBitmaps(FaviconID icon_id, |
105 std::vector<FaviconBitmap>* favicon_bitmaps); | 113 std::vector<FaviconBitmap>* favicon_bitmaps); |
106 | 114 |
| 115 // Gets the last updated time, bitmap data, and pixel size of the favicon |
| 116 // bitmap at |bitmap_id|. Returns true if successful. |
| 117 bool GetFaviconBitmap(FaviconBitmapID bitmap_id, |
| 118 base::Time* last_updated, |
| 119 scoped_refptr<base::RefCountedMemory>* png_icon_data, |
| 120 gfx::Size* pixel_size); |
| 121 |
| 122 // Sets the bitmap data and the last updated time for the favicon bitmap at |
| 123 // |bitmap_id|. |
| 124 // Returns true if successful. |
| 125 bool SetFaviconBitmap(FaviconBitmapID bitmap_id, |
| 126 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 127 base::Time time); |
| 128 |
107 // Adds a bitmap component at |pixel_size| for the favicon with |icon_id|. | 129 // Adds a bitmap component at |pixel_size| for the favicon with |icon_id|. |
108 // Only favicons representing a .ico file should have multiple favicon bitmaps | 130 // Only favicons representing a .ico file should have multiple favicon bitmaps |
109 // per favicon. | 131 // per favicon. |
110 // |icon_data| is the png encoded data. | 132 // |icon_data| is the png encoded data. |
111 // The |time| indicates the access time, and is used to detect when the | 133 // The |time| indicates the access time, and is used to detect when the |
112 // favicon should be refreshed. | 134 // favicon should be refreshed. |
113 // |pixel_size| is the pixel dimensions of |icon_data|. | 135 // |pixel_size| is the pixel dimensions of |icon_data|. |
114 // Returns the id of the added bitmap or 0 if unsuccessful. | 136 // Returns the id of the added bitmap or 0 if unsuccessful. |
115 FaviconBitmapID AddFaviconBitmap( | 137 FaviconBitmapID AddFaviconBitmap( |
116 FaviconID icon_id, | 138 FaviconID icon_id, |
117 const scoped_refptr<base::RefCountedMemory>& icon_data, | 139 const scoped_refptr<base::RefCountedMemory>& icon_data, |
118 base::Time time, | 140 base::Time time, |
119 const gfx::Size& pixel_size); | 141 const gfx::Size& pixel_size); |
120 | 142 |
121 // Deletes the favicon bitmaps for the favicon with with |icon_id|. | 143 // Deletes the favicon bitmap with |bitmap_id|. |
122 // Returns true if successful. | 144 // Returns true if successful. |
123 bool DeleteFaviconBitmapsForFavicon(FaviconID icon_id); | 145 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); |
124 | 146 |
125 // Favicons ------------------------------------------------------------------ | 147 // Favicons ------------------------------------------------------------------ |
126 | 148 |
127 // Updates the favicon sizes associated with a favicon to |favicon_sizes|. | 149 // Updates the favicon sizes associated with a favicon to |favicon_sizes|. |
128 // See comment in history_types.h for description of |favicon_sizes|. | 150 // See comment in history_types.h for description of |favicon_sizes|. |
129 bool SetFaviconSizes(FaviconID icon_id, const FaviconSizes& favicon_sizes); | 151 bool SetFaviconSizes(FaviconID icon_id, const FaviconSizes& favicon_sizes); |
130 | 152 |
131 // Sets the the favicon as out of date. This will set |last_updated| for all | 153 // Sets the the favicon as out of date. This will set |last_updated| for all |
132 // of the bitmaps for |icon_id| to be out of date. | 154 // of the bitmaps for |icon_id| to be out of date. |
133 bool SetFaviconOutOfDate(FaviconID icon_id); | 155 bool SetFaviconOutOfDate(FaviconID icon_id); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 219 |
198 // Updates the page and icon mapping for the given mapping_id with the given | 220 // Updates the page and icon mapping for the given mapping_id with the given |
199 // icon_id. | 221 // icon_id. |
200 // Returns true if the update succeeded. | 222 // Returns true if the update succeeded. |
201 bool UpdateIconMapping(IconMappingID mapping_id, FaviconID icon_id); | 223 bool UpdateIconMapping(IconMappingID mapping_id, FaviconID icon_id); |
202 | 224 |
203 // Deletes the icon mapping entries for the given page url. | 225 // Deletes the icon mapping entries for the given page url. |
204 // Returns true if the deletion succeeded. | 226 // Returns true if the deletion succeeded. |
205 bool DeleteIconMappings(const GURL& page_url); | 227 bool DeleteIconMappings(const GURL& page_url); |
206 | 228 |
| 229 // Deletes the icon mapping with |mapping_id|. |
| 230 // Returns true if the deletion succeeded. |
| 231 bool DeleteIconMapping(IconMappingID mapping_id); |
| 232 |
207 // Checks whether a favicon is used by any URLs in the database. | 233 // Checks whether a favicon is used by any URLs in the database. |
208 bool HasMappingFor(FaviconID id); | 234 bool HasMappingFor(FaviconID id); |
209 | 235 |
210 // Clones the existing mappings from |old_page_url| if |new_page_url| has no | 236 // Clones the existing mappings from |old_page_url| if |new_page_url| has no |
211 // mappings. Otherwise, will leave mappings alone. | 237 // mappings. Otherwise, will leave mappings alone. |
212 bool CloneIconMappings(const GURL& old_page_url, const GURL& new_page_url); | 238 bool CloneIconMappings(const GURL& old_page_url, const GURL& new_page_url); |
213 | 239 |
214 // The class to enumerate icon mappings. Use InitIconMappingEnumerator to | 240 // The class to enumerate icon mappings. Use InitIconMappingEnumerator to |
215 // initialize. | 241 // initialize. |
216 class IconMappingEnumerator { | 242 class IconMappingEnumerator { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 const HistoryPublisher* history_publisher_; | 407 const HistoryPublisher* history_publisher_; |
382 | 408 |
383 // True if migration to TopSites has been done and the thumbnails | 409 // True if migration to TopSites has been done and the thumbnails |
384 // table should not be used. | 410 // table should not be used. |
385 bool use_top_sites_; | 411 bool use_top_sites_; |
386 }; | 412 }; |
387 | 413 |
388 } // namespace history | 414 } // namespace history |
389 | 415 |
390 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 416 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
OLD | NEW |