Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1826)

Unified Diff: chrome/browser/history/thumbnail_database.h

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as requested by Sky and stevenjb Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/thumbnail_database.h
diff --git a/chrome/browser/history/thumbnail_database.h b/chrome/browser/history/thumbnail_database.h
index bfd40b439b4927e7b5195d87388718ee7436a88a..0f4580ca2191a63c63926b1ae0330bbff9fdbf66 100644
--- a/chrome/browser/history/thumbnail_database.h
+++ b/chrome/browser/history/thumbnail_database.h
@@ -147,11 +147,24 @@ class ThumbnailDatabase {
// Favicon Bitmaps -----------------------------------------------------------
+ // Returns a listing of the favicon bitmap ids and their associated pixel
+ // sizes for the favicon with |icon_id|. Returns true if the listing has at
+ // least one entry.
+ bool GetFaviconBitmapIDSizeListing(
+ FaviconID icon_id,
+ std::vector<FaviconBitmapIDSize>* bitmap_size_listing);
+
// Returns true if there are any matched bitmaps for the given |icon_id|. All
// matched results are returned if |favicon_bitmaps| is not NULL.
bool GetFaviconBitmaps(FaviconID icon_id,
std::vector<FaviconBitmap>* favicon_bitmaps);
+ // Returns true if there is a favicon bitmap with |bitmap_id|. The bitmap
+ // data is returned in the |favicon_bitmap| output parameter if it is not
+ // NULL.
+ bool GetFaviconBitmap(FaviconBitmapID bitmap_id,
+ FaviconBitmap* favicon_bitmap);
+
// Adds a bitmap component at |pixel_size| for the favicon with |icon_id|.
// Only favicons representing a .ico file should have multiple favicon bitmaps
// per favicon.
@@ -166,13 +179,15 @@ class ThumbnailDatabase {
base::Time time,
const gfx::Size& pixel_size);
- // Sets the bitmap data and the last updated time for a favicon bitmap
- // contained by the favicon at |favicon_id|. Returns true if successful.
- // TODO(pkotwicz): Use FaviconBitmapID instead.
- bool SetFaviconBitmap(FaviconID favicon_id,
+ // Sets the bitmap data and the last updated time for the favicon bitmap at
+ // |bitmap_id|. Returns true if successful.
+ bool SetFaviconBitmap(FaviconBitmapID bitmap_id,
scoped_refptr<base::RefCountedMemory> icon_data,
base::Time time);
+ // Deletes the favicon bitmap with |bitmap_id|. Returns true if successful.
+ bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id);
+
// Favicons ------------------------------------------------------------------
// Updates the sizes associated with a favicon to |sizes|. See the comment
@@ -180,28 +195,18 @@ class ThumbnailDatabase {
bool SetFaviconSizes(FaviconID icon_id, const std::string& sizes);
// Sets the the favicon as out of date. This will set |last_updated| for all
- // of the bitmaps for |icon_id| to be out of date.
+ // of the favicon bitmaps 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
// there are more than one matched icon in database, only one icon will be
// returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and
- // FAVICON, and the icon type is returned in icon_type parameter if it is not
- // NULL.
+ // FAVICON.
// Returns 0 if no entry exists for the specified url.
FaviconID GetFaviconIDForFaviconURL(const GURL& icon_url,
- int required_icon_type,
- IconType* icon_type);
-
- // Gets the png encoded favicon, last updated time, icon_url and icon_type for
- // the specified favicon id.
- // TODO(pkotwicz): Remove this function.
- bool GetFavicon(FaviconID icon_id,
- base::Time* last_updated,
- scoped_refptr<base::RefCountedMemory>* png_icon_data,
- GURL* icon_url,
- IconType* icon_type);
+ int required_icon_type);
+
// Gets the icon_url, icon_type and sizes for the specified |icon_id|.
bool GetFaviconHeader(FaviconID icon_id,
@@ -209,7 +214,8 @@ class ThumbnailDatabase {
IconType* icon_type,
std::string* sizes);
- // Adds the favicon URL and icon type to the favicon db, returning its id.
+ // Adds favicon with |icon_url| and |icon_type| to the favicon db, returning
+ // its id.
FaviconID AddFavicon(const GURL& icon_url, IconType icon_type);
// Adds a favicon with a single bitmap. This call is equivalent to calling
@@ -230,9 +236,17 @@ class ThumbnailDatabase {
// icon type.
// The matched icon mapping is returned in the icon_mapping parameter if it is
// not NULL.
- bool GetIconMappingForPageURL(const GURL& page_url,
- IconType required_icon_type,
- IconMapping* icon_mapping);
+
+ // Returns true if there are icon mappings for the given page and icon type.
+ // If |required_icon_types| contains multiple icon types and there is more
+ // than one matched icon type in the database, icons of only a single type
+ // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON,
+ // and FAVICON.
+ // The matched icon mappings are returned in the |icon_mappings| parameter if
+ // it is not NULL.
+ bool GetIconMappingsForPageURL(const GURL& page_url,
+ int required_icon_types,
+ std::vector<IconMapping>* mapping_data);
// Returns true if there is any matched icon mapping for the given page.
// All matched icon mappings are returned in descent order of IconType if
@@ -253,6 +267,10 @@ class ThumbnailDatabase {
// Returns true if the deletion succeeded.
bool DeleteIconMappings(const GURL& page_url);
+ // Deletes the icon mapping with |mapping_id|.
+ // Returns true if the deletion succeeded.
+ bool DeleteIconMapping(IconMappingID mapping_id);
+
// Checks whether a favicon is used by any URLs in the database.
bool HasMappingFor(FaviconID id);

Powered by Google App Engine
This is Rietveld 408576698