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_id_sizes| is non NULL, sets it to a list of the favicon bitmap ids |
| 104 // and their associated pixel sizes for the favicon with |icon_id|. |
| 105 // The list contains results for the bitmaps which are cached in the |
| 106 // favicon_bitmaps table. The pixel sizes are a subset of the sizes in the |
| 107 // 'sizes' field of the favicons table for |icon_id|. |
| 108 bool GetFaviconBitmapIDSizes( |
| 109 FaviconID icon_id, |
| 110 std::vector<FaviconBitmapIDSize>* bitmap_id_sizes); |
| 111 |
102 // Returns true if there are any matched bitmaps for the given |icon_id|. All | 112 // 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. | 113 // matched results are returned if |favicon_bitmaps| is not NULL. |
104 bool GetFaviconBitmaps(FaviconID icon_id, | 114 bool GetFaviconBitmaps(FaviconID icon_id, |
105 std::vector<FaviconBitmap>* favicon_bitmaps); | 115 std::vector<FaviconBitmap>* favicon_bitmaps); |
106 | 116 |
| 117 // Gets the last updated time, bitmap data, and pixel size of the favicon |
| 118 // bitmap at |bitmap_id|. Returns true if successful. |
| 119 bool GetFaviconBitmap(FaviconBitmapID bitmap_id, |
| 120 base::Time* last_updated, |
| 121 scoped_refptr<base::RefCountedMemory>* png_icon_data, |
| 122 gfx::Size* pixel_size); |
| 123 |
107 // Adds a bitmap component at |pixel_size| for the favicon with |icon_id|. | 124 // 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 | 125 // Only favicons representing a .ico file should have multiple favicon bitmaps |
109 // per favicon. | 126 // per favicon. |
110 // |icon_data| is the png encoded data. | 127 // |icon_data| is the png encoded data. |
111 // The |time| indicates the access time, and is used to detect when the | 128 // The |time| indicates the access time, and is used to detect when the |
112 // favicon should be refreshed. | 129 // favicon should be refreshed. |
113 // |pixel_size| is the pixel dimensions of |icon_data|. | 130 // |pixel_size| is the pixel dimensions of |icon_data|. |
114 // Returns the id of the added bitmap or 0 if unsuccessful. | 131 // Returns the id of the added bitmap or 0 if unsuccessful. |
115 FaviconBitmapID AddFaviconBitmap( | 132 FaviconBitmapID AddFaviconBitmap( |
116 FaviconID icon_id, | 133 FaviconID icon_id, |
117 const scoped_refptr<base::RefCountedMemory>& icon_data, | 134 const scoped_refptr<base::RefCountedMemory>& icon_data, |
118 base::Time time, | 135 base::Time time, |
119 const gfx::Size& pixel_size); | 136 const gfx::Size& pixel_size); |
120 | 137 |
| 138 // Sets the bitmap data and the last updated time for the favicon bitmap at |
| 139 // |bitmap_id|. |
| 140 // Returns true if successful. |
| 141 bool SetFaviconBitmap(FaviconBitmapID bitmap_id, |
| 142 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 143 base::Time time); |
| 144 |
121 // Deletes the favicon bitmaps for the favicon with with |icon_id|. | 145 // Deletes the favicon bitmaps for the favicon with with |icon_id|. |
122 // Returns true if successful. | 146 // Returns true if successful. |
123 bool DeleteFaviconBitmapsForFavicon(FaviconID icon_id); | 147 bool DeleteFaviconBitmapsForFavicon(FaviconID icon_id); |
124 | 148 |
| 149 // Deletes the favicon bitmap with |bitmap_id|. |
| 150 // Returns true if successful. |
| 151 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); |
| 152 |
125 // Favicons ------------------------------------------------------------------ | 153 // Favicons ------------------------------------------------------------------ |
126 | 154 |
127 // Updates the favicon sizes associated with a favicon to |favicon_sizes|. | 155 // Updates the favicon sizes associated with a favicon to |favicon_sizes|. |
128 // See comment in history_types.h for description of |favicon_sizes|. | 156 // See comment in history_types.h for description of |favicon_sizes|. |
129 bool SetFaviconSizes(FaviconID icon_id, const FaviconSizes& favicon_sizes); | 157 bool SetFaviconSizes(FaviconID icon_id, const FaviconSizes& favicon_sizes); |
130 | 158 |
131 // Sets the the favicon as out of date. This will set |last_updated| for all | 159 // 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. | 160 // of the bitmaps for |icon_id| to be out of date. |
133 bool SetFaviconOutOfDate(FaviconID icon_id); | 161 bool SetFaviconOutOfDate(FaviconID icon_id); |
134 | 162 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 const HistoryPublisher* history_publisher_; | 413 const HistoryPublisher* history_publisher_; |
386 | 414 |
387 // True if migration to TopSites has been done and the thumbnails | 415 // True if migration to TopSites has been done and the thumbnails |
388 // table should not be used. | 416 // table should not be used. |
389 bool use_top_sites_; | 417 bool use_top_sites_; |
390 }; | 418 }; |
391 | 419 |
392 } // namespace history | 420 } // namespace history |
393 | 421 |
394 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 422 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
OLD | NEW |