| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void TrimMemory(bool aggressively); | 60 void TrimMemory(bool aggressively); |
| 61 | 61 |
| 62 // Favicon Bitmaps ----------------------------------------------------------- | 62 // Favicon Bitmaps ----------------------------------------------------------- |
| 63 | 63 |
| 64 // Returns true if there are favicon bitmaps for |icon_id|. If | 64 // Returns true if there are favicon bitmaps for |icon_id|. If |
| 65 // |bitmap_id_sizes| is non NULL, sets it to a list of the favicon bitmap ids | 65 // |bitmap_id_sizes| is non NULL, sets it to a list of the favicon bitmap ids |
| 66 // and their associated pixel sizes for the favicon with |icon_id|. | 66 // and their associated pixel sizes for the favicon with |icon_id|. |
| 67 // The list contains results for the bitmaps which are cached in the | 67 // The list contains results for the bitmaps which are cached in the |
| 68 // favicon_bitmaps table. The pixel sizes are a subset of the sizes in the | 68 // favicon_bitmaps table. The pixel sizes are a subset of the sizes in the |
| 69 // 'sizes' field of the favicons table for |icon_id|. | 69 // 'sizes' field of the favicons table for |icon_id|. |
| 70 bool GetFaviconBitmapIDSizes( | 70 bool GetFaviconRawBitmapIDSizes( |
| 71 favicon_base::FaviconID icon_id, | 71 favicon_base::FaviconID icon_id, |
| 72 std::vector<FaviconBitmapIDSize>* bitmap_id_sizes); | 72 std::vector<FaviconRawBitmapIDSize>* bitmap_id_sizes); |
| 73 | 73 |
| 74 // Returns true if there are any matched bitmaps for the given |icon_id|. All | 74 // Returns true if there are any matched bitmaps for the given |icon_id|. All |
| 75 // matched results are returned if |favicon_bitmaps| is not NULL. | 75 // matched results are returned if |favicon_bitmaps| is not NULL. |
| 76 bool GetFaviconBitmaps(favicon_base::FaviconID icon_id, | 76 bool GetFaviconRawBitmaps(favicon_base::FaviconID icon_id, |
| 77 std::vector<FaviconBitmap>* favicon_bitmaps); | 77 std::vector<FaviconRawBitmap>* favicon_bitmaps); |
| 78 | 78 |
| 79 // Gets the last updated time, bitmap data, and pixel size of the favicon | 79 // Gets the last updated time, bitmap data, and pixel size of the favicon |
| 80 // bitmap at |bitmap_id|. Returns true if successful. | 80 // bitmap at |bitmap_id|. Returns true if successful. |
| 81 bool GetFaviconBitmap(FaviconBitmapID bitmap_id, | 81 bool GetFaviconRawBitmap(FaviconRawBitmapID bitmap_id, |
| 82 base::Time* last_updated, | 82 base::Time* last_updated, |
| 83 scoped_refptr<base::RefCountedMemory>* png_icon_data, | 83 scoped_refptr<base::RefCountedMemory>* png_icon_data, |
| 84 gfx::Size* pixel_size); | 84 gfx::Size* pixel_size); |
| 85 | 85 |
| 86 // Adds a bitmap component at |pixel_size| for the favicon with |icon_id|. | 86 // Adds a bitmap component at |pixel_size| for the favicon with |icon_id|. |
| 87 // Only favicons representing a .ico file should have multiple favicon bitmaps | 87 // Only favicons representing a .ico file should have multiple favicon bitmaps |
| 88 // per favicon. | 88 // per favicon. |
| 89 // |icon_data| is the png encoded data. | 89 // |icon_data| is the png encoded data. |
| 90 // The |time| indicates the access time, and is used to detect when the | 90 // The |time| indicates the access time, and is used to detect when the |
| 91 // favicon should be refreshed. | 91 // favicon should be refreshed. |
| 92 // |pixel_size| is the pixel dimensions of |icon_data|. | 92 // |pixel_size| is the pixel dimensions of |icon_data|. |
| 93 // Returns the id of the added bitmap or 0 if unsuccessful. | 93 // Returns the id of the added bitmap or 0 if unsuccessful. |
| 94 FaviconBitmapID AddFaviconBitmap( | 94 FaviconRawBitmapID AddFaviconRawBitmap( |
| 95 favicon_base::FaviconID icon_id, | 95 favicon_base::FaviconID icon_id, |
| 96 const scoped_refptr<base::RefCountedMemory>& icon_data, | 96 const scoped_refptr<base::RefCountedMemory>& icon_data, |
| 97 base::Time time, | 97 base::Time time, |
| 98 const gfx::Size& pixel_size); | 98 const gfx::Size& pixel_size); |
| 99 | 99 |
| 100 // Sets the bitmap data and the last updated time for the favicon bitmap at | 100 // Sets the bitmap data and the last updated time for the favicon bitmap at |
| 101 // |bitmap_id|. | 101 // |bitmap_id|. |
| 102 // Returns true if successful. | 102 // Returns true if successful. |
| 103 bool SetFaviconBitmap(FaviconBitmapID bitmap_id, | 103 bool SetFaviconRawBitmap(FaviconRawBitmapID bitmap_id, |
| 104 scoped_refptr<base::RefCountedMemory> bitmap_data, | 104 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 105 base::Time time); | 105 base::Time time); |
| 106 | 106 |
| 107 // Sets the last updated time for the favicon bitmap at |bitmap_id|. | 107 // Sets the last updated time for the favicon bitmap at |bitmap_id|. |
| 108 // Returns true if successful. | 108 // Returns true if successful. |
| 109 bool SetFaviconBitmapLastUpdateTime(FaviconBitmapID bitmap_id, | 109 bool SetFaviconRawBitmapLastUpdateTime(FaviconRawBitmapID bitmap_id, |
| 110 base::Time time); | 110 base::Time time); |
| 111 | 111 |
| 112 // Deletes the favicon bitmap with |bitmap_id|. | 112 // Deletes the favicon bitmap with |bitmap_id|. |
| 113 // Returns true if successful. | 113 // Returns true if successful. |
| 114 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); | 114 bool DeleteFaviconRawBitmap(FaviconRawBitmapID bitmap_id); |
| 115 | 115 |
| 116 // Favicons ------------------------------------------------------------------ | 116 // Favicons ------------------------------------------------------------------ |
| 117 | 117 |
| 118 // Sets the the favicon as out of date. This will set |last_updated| for all | 118 // Sets the the favicon as out of date. This will set |last_updated| for all |
| 119 // of the bitmaps for |icon_id| to be out of date. | 119 // of the bitmaps for |icon_id| to be out of date. |
| 120 bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); | 120 bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); |
| 121 | 121 |
| 122 // Returns the id of the entry in the favicon database with the specified url | 122 // Returns the id of the entry in the favicon database with the specified url |
| 123 // and icon type. If |required_icon_type| contains multiple icon types and | 123 // and icon type. If |required_icon_type| contains multiple icon types and |
| 124 // there are more than one matched icon in database, only one icon will be | 124 // there are more than one matched icon in database, only one icon will be |
| (...skipping 10 matching lines...) Expand all Loading... |
| 135 bool GetFaviconHeader(favicon_base::FaviconID icon_id, | 135 bool GetFaviconHeader(favicon_base::FaviconID icon_id, |
| 136 GURL* icon_url, | 136 GURL* icon_url, |
| 137 favicon_base::IconType* icon_type); | 137 favicon_base::IconType* icon_type); |
| 138 | 138 |
| 139 // Adds favicon with |icon_url|, |icon_type| and |favicon_sizes| to the | 139 // Adds favicon with |icon_url|, |icon_type| and |favicon_sizes| to the |
| 140 // favicon db, returning its id. | 140 // favicon db, returning its id. |
| 141 favicon_base::FaviconID AddFavicon(const GURL& icon_url, | 141 favicon_base::FaviconID AddFavicon(const GURL& icon_url, |
| 142 favicon_base::IconType icon_type); | 142 favicon_base::IconType icon_type); |
| 143 | 143 |
| 144 // Adds a favicon with a single bitmap. This call is equivalent to calling | 144 // Adds a favicon with a single bitmap. This call is equivalent to calling |
| 145 // AddFavicon and AddFaviconBitmap. | 145 // AddFavicon and AddFaviconRawBitmap. |
| 146 favicon_base::FaviconID AddFavicon( | 146 favicon_base::FaviconID AddFavicon( |
| 147 const GURL& icon_url, | 147 const GURL& icon_url, |
| 148 favicon_base::IconType icon_type, | 148 favicon_base::IconType icon_type, |
| 149 const scoped_refptr<base::RefCountedMemory>& icon_data, | 149 const scoped_refptr<base::RefCountedMemory>& icon_data, |
| 150 base::Time time, | 150 base::Time time, |
| 151 const gfx::Size& pixel_size); | 151 const gfx::Size& pixel_size); |
| 152 | 152 |
| 153 // Delete the favicon with the provided id. Returns false on failure | 153 // Delete the favicon with the provided id. Returns false on failure |
| 154 bool DeleteFavicon(favicon_base::FaviconID id); | 154 bool DeleteFavicon(favicon_base::FaviconID id); |
| 155 | 155 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Returns true if the |favicons| database is missing a column. | 265 // Returns true if the |favicons| database is missing a column. |
| 266 bool IsFaviconDBStructureIncorrect(); | 266 bool IsFaviconDBStructureIncorrect(); |
| 267 | 267 |
| 268 sql::Connection db_; | 268 sql::Connection db_; |
| 269 sql::MetaTable meta_table_; | 269 sql::MetaTable meta_table_; |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 } // namespace history | 272 } // namespace history |
| 273 | 273 |
| 274 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 274 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
| OLD | NEW |