Index: chrome/browser/history/thumbnail_database.h |
diff --git a/chrome/browser/history/thumbnail_database.h b/chrome/browser/history/thumbnail_database.h |
index e2209e17a6af2405519645408b3f8c46e1721637..586ebf3a90d8c62edab2a6a0df1dd47a4bcb82b0 100644 |
--- a/chrome/browser/history/thumbnail_database.h |
+++ b/chrome/browser/history/thumbnail_database.h |
@@ -99,15 +99,19 @@ class ThumbnailDatabase { |
// Favicons ------------------------------------------------------------------ |
- // Sets the bits for a favicon. This should be png encoded data. |
+ // Add a favicon frame. A favicon frame represents a bitmap component for a |
+ // particular size in an image file. Only favicons representing a .ico file |
+ // should have multiple favicon frames per favicon. |
+ // |icon_data| is the png encoded data. |
// The time indicates the access time, and is used to detect when the favicon |
// should be refreshed. |
- bool SetFavicon(FaviconID icon_id, |
- scoped_refptr<base::RefCountedMemory> icon_data, |
- base::Time time); |
+ bool AddFaviconFrame(FaviconID icon_id, |
sky
2012/08/02 19:50:31
Can you use Image or Bitmap instead of Frame in al
|
+ scoped_refptr<base::RefCountedMemory> icon_data, |
+ base::Time time); |
- // Sets the time the favicon was last updated. |
- bool SetFaviconLastUpdateTime(FaviconID icon_id, base::Time time); |
+ // Sets the the favicon as out of date. This will set |last_updated| for all |
+ // of the frames for |icon_id| to be out of date. |
+ bool SetFaviconOutOfDate(FaviconID icon_id); |
// Returns the id of the entry in the favicon database with the specified url |
// and icon type. If |required_icon_type| contains multiple icon types and |
@@ -128,6 +132,12 @@ class ThumbnailDatabase { |
GURL* icon_url, |
IconType* icon_type); |
+ // Gets the png encoded favicon and last updated time for the specified |
+ // favicon id. |
+ bool GetFaviconFrame(FaviconID icon_id, |
sky
2012/08/02 19:50:31
Won't this need to take something that returns a v
|
+ base::Time* last_updated, |
+ std::vector<unsigned char>* png_icon_data); |
+ |
// Adds the favicon URL and icon type to the favicon db, returning its id. |
FaviconID AddFavicon(const GURL& icon_url, IconType icon_type); |
@@ -238,11 +248,30 @@ class ThumbnailDatabase { |
// is returned, or 0 on failure. |
FaviconID CopyToTemporaryFaviconTable(FaviconID source); |
- // Replaces the main URL table with the temporary table created by |
+ // Replaces the main favicon table with the temporary table created by |
// InitTemporaryFaviconsTable(). This will mean all favicons not copied over |
// will be deleted. Returns true on success. |
bool CommitTemporaryFaviconTable(); |
+ // Create a temporary table to store the favicon frames. Favicon frames will |
+ // be copied to this table by CopyToTemporaryFaviconFramesTable() and then the |
+ // original table will be dropped, leaving only the copied favicons |
+ // remaining. |
+ bool InitTemporaryFaviconFramesTable() { |
+ return InitFaviconFramesTable(&db_, true); |
+ } |
+ |
+ // Copies the frames corresponding to |icon_id| from the "main" favicon table |
+ // to the temporary one. This is only valid in between calls to |
+ // InitTemporaryFaviconFramesTable() |
+ // and CommitTemporaryFaviconFrameTable(). |
+ void CopyToTemporaryFaviconFramesTable(FaviconID icon_id); |
+ |
+ // Replaces the main favicon frame table with the temporary table created by |
+ // InitTemporaryFaviconFramesTable(). This means that all favicon frames not |
+ // copied over will be deleted. Returns true on success. |
+ bool CommitTemporaryFaviconFrameTable(); |
+ |
// Returns true iff the thumbnails table exists. |
// Migrating to TopSites is dropping the thumbnails table. |
bool NeedsMigrationToTopSites(); |
@@ -257,21 +286,13 @@ class ThumbnailDatabase { |
GetFaviconAfterMigrationToTopSites); |
FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion4); |
FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion5); |
+ FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion6); |
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MigrationIconMapping); |
// Creates the thumbnail table, returning true if the table already exists |
// or was successfully created. |
bool InitThumbnailTable(); |
- // Creates the favicon table, returning true if the table already exists, |
- // or was successfully created. |is_temporary| will be false when generating |
- // the "regular" favicons table. The expirer sets this to true to generate the |
- // temporary table, which will have a different name but the same schema. |
- // |db| is the connection to use for initializing the table. |
- // A different connection is used in RenameAndDropThumbnails, when we |
- // need to copy the favicons between two database files. |
- bool InitFaviconsTable(sql::Connection* db, bool is_temporary); |
- |
// Helper function to handle cleanup on upgrade failures. |
sql::InitStatus CantUpgradeToVersion(int cur_version); |
@@ -284,16 +305,39 @@ class ThumbnailDatabase { |
// Adds support for sizes in favicon table. |
bool UpgradeToVersion5(); |
+ // Adds support for size in favicons table and removes sizes column. |
+ bool UpgradeToVersion6(); |
+ |
// Migrates the icon mapping data from URL database to Thumbnail database. |
// Return whether the migration succeeds. |
bool MigrateIconMappingData(URLDatabase* url_db); |
+ // Creates the favicon table, returning true if the table already exists, |
+ // or was successfully created. |is_temporary| will be false when generating |
+ // the "regular" favicons table. The expirer sets this to true to generate the |
+ // temporary table, which will have a different name but the same schema. |
+ // |db| is the connection to use for initializing the table. |
+ // A different connection is used in RenameAndDropThumbnails, when we |
+ // need to copy the favicons between two database files. |
+ bool InitFaviconsTable(sql::Connection* db, bool is_temporary); |
+ |
// Creates the index over the favicon table. This will be called during |
// initialization after the table is created. This is a separate function |
// because it is used by SwapFaviconTables to create an index over the |
// newly-renamed favicons table (formerly the temporary table with no index). |
bool InitFaviconsIndex(); |
+ // Creates the favicon_frames table, return true if the table already exists |
+ // or was successfully created. |
+ bool InitFaviconFramesTable(sql::Connection* db, bool is_temporary); |
+ |
+ // Creates the index over the favicon_frames table. This will be called |
+ // during initialization after the table is created. This is a separate |
+ // function because it is used by CommitTemporaryFaviconFrameTable to create |
+ // an index over the newly-renamed favicon_frames table (formerly the |
+ // temporary table with no index). |
+ bool InitFaviconFramesIndex(); |
+ |
// Creates the icon_map table, return true if the table already exists or was |
// successfully created. |
bool InitIconMappingTable(sql::Connection* db, bool is_temporary); |