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

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

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/history_types.h
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index 2408d4c5165a3c88034330705098abca9486ec2b..bd440840f405aab1f872a9bcd3b80a1888430b75 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -274,23 +274,6 @@ typedef std::vector<VisitRow> VisitVector;
// used by HistoryBackend::AddVisits() to create new visits for a URL.
typedef std::pair<base::Time, content::PageTransition> VisitInfo;
-// Favicons -------------------------------------------------------------------
-
-// Used by the importer to set favicons for imported bookmarks.
-struct ImportedFaviconUsage {
- ImportedFaviconUsage();
- ~ImportedFaviconUsage();
-
- // The URL of the favicon.
- GURL favicon_url;
-
- // The raw png-encoded data.
- std::vector<unsigned char> png_data;
-
- // The list of URLs using this favicon.
- std::set<GURL> urls;
-};
-
// PageVisit ------------------------------------------------------------------
// Represents a simplified version of a visit for external users. Normally,
@@ -772,28 +755,59 @@ struct IconMapping {
IconType icon_type;
};
-// Defines the favicon stored in history backend.
+// Defines a favicon bitmap stored in the history backend.
+struct FaviconBitmapData {
+ FaviconBitmapData();
+ ~FaviconBitmapData();
+
+ // Returns true if |bitmap_data| contains a valid bitmap.
+ bool is_valid() const;
+
+ // Indicates whether |bitmap_data| is expired.
+ bool expired;
+
+ // The bits of the bitmap.
+ scoped_refptr<base::RefCountedMemory> bitmap_data;
+
+ // The pixel dimensions of |bitmap_data|.
+ gfx::Size pixel_size;
+};
+
+// Defines the result of a query for favicon data.
struct FaviconData {
FaviconData();
~FaviconData();
- // Returns true if the icon is known and image has data.
- bool is_valid();
+ // Returns true if the icon is known, |bitmaps| has at least one
+ // FaviconBitmapData element and all of the FaviconBitmapData in
+ // |urls| are valid.
+ bool has_valid_bitmaps() const;
- // Indicates whether the icon is known by the history backend.
- bool known_icon;
+ // Returns true if the data for at least one of the bitmaps is expired.
+ bool expired() const;
- // The bits of image.
- scoped_refptr<base::RefCountedMemory> image_data;
+ // Returns the |bitmap_data| of the first entry in |bitmaps|. If |bitmaps| is
+ // empty a scoped_reptr pointing to NULL is returned instead.
+ scoped_refptr<base::RefCountedMemory> first_bitmap() const;
- // Indicates whether image is expired.
- bool expired;
+ // Indicates whether the icon is known to the history backend.
+ bool known_icon;
// The icon's URL.
GURL icon_url;
- // The type of favicon.
- history::IconType icon_type;
+ // The type of the favicon.
+ IconType icon_type;
+
+ // The sizes at which the favicon is available at from the web. For instance
sky 2012/08/23 15:50:38 'available at' -> available
+ // if this object represents a .ico file with bitmaps of pixel sizes 16x16
+ // and 32x32, |sizes| will have two entries. |bitmaps| does not necessarily
+ // have entries for each entry in |sizes|.
sky 2012/08/23 15:50:38 Document ordering of sizes.
pkotwicz 2012/08/27 02:24:35 My implementation doesn't specify an ordering of s
+ std::vector<gfx::Size> sizes;
+
+ // The bitmaps whose pixel sizes best match the optimal favicon size of 16x16
sky 2012/08/23 15:50:38 Won't this depend upon the query?
+ // for 1x and 32x32 for 2x.
+ std::vector<FaviconBitmapData> bitmaps;
};
// Defines a favicon bitmap stored in the history backend.
@@ -817,6 +831,21 @@ struct FaviconBitmap {
gfx::Size pixel_size;
};
+// Used by the importer to set favicons for imported bookmarks.
+struct ImportedFaviconUsage {
+ ImportedFaviconUsage();
+ ~ImportedFaviconUsage();
+
+ // The URL of the favicon.
+ GURL favicon_url;
+
+ // The raw png-encoded data.
+ std::vector<unsigned char> png_data;
+
+ // The list of URLs using this favicon.
+ std::set<GURL> urls;
+};
+
// Abbreviated information about a visit.
struct BriefVisitInfo {
URLID url_id;

Powered by Google App Engine
This is Rietveld 408576698