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

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..308ed3f15eed16044d2ee69b304729a75187eb7d 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -22,6 +22,7 @@
#include "chrome/common/thumbnail_score.h"
#include "content/public/common/page_transition_types.h"
#include "googleurl/src/gurl.h"
+#include "ui/gfx/image/image.h"
#include "ui/gfx/size.h"
class PageUsageData;
@@ -274,23 +275,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,30 +756,58 @@ struct IconMapping {
IconType icon_type;
};
-// Defines the favicon stored in history backend.
-struct FaviconData {
- FaviconData();
- ~FaviconData();
+// Defines a favicon bitmap which best matches desired DIP size and one of the
+// desired scale factors.
+struct FaviconBitmapResult {
+ FaviconBitmapResult();
+ ~FaviconBitmapResult();
- // Returns true if the icon is known and image has data.
- bool is_valid();
+ // Returns true if |bitmap_data| contains a valid bitmap.
+ bool is_valid() const { return bitmap_data.get() && bitmap_data->size(); }
- // Indicates whether the icon is known by the history backend.
- bool known_icon;
+ // Indicates whether |bitmap_data| is expired.
+ bool expired;
- // The bits of image.
- scoped_refptr<base::RefCountedMemory> image_data;
+ // The bits of the bitmap.
+ scoped_refptr<base::RefCountedMemory> bitmap_data;
- // Indicates whether image is expired.
- bool expired;
+ // The pixel dimensions of |bitmap_data|.
+ gfx::Size pixel_size;
- // The icon's URL.
+ // The URL of the containing favicon.
GURL icon_url;
- // The type of favicon.
- history::IconType icon_type;
+ // The Icon type of the containing favicon.
+ IconType icon_type;
+};
+
+// Defines a gfx::Image of size desired_size_in_dip composed of image
+// representations for each of the desired scale factors.
+struct FaviconImageResult {
+ FaviconImageResult();
+ ~FaviconImageResult();
+
+ // The resulting image.
+ gfx::Image image;
+
+ // The URL of the favicon which contains all of the image representations of
+ // |image|.
+ // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
+ // representations from several favicons once content::FaviconStatus supports
+ // multiple URLs.
+ GURL icon_url;
};
+// A map from an icon URL to a vector of the sizes of the favicon bitmaps at
+// that URL. There are several sizes for an icon URL only if the icon URL is
+// for a .ico file. The sizes for an icon URL represent the sizes that a
+// favicon is available from the web, not the sizes at which bitmaps are
+// cached in the thumbnail database for the icon URL. For instance, if an icon
+// URL represents a .ico file with 16x16 and 32x32 bitmaps, the sizes vector
+// will have both sizes regardless of whether either of these bitmaps is cached
+// in the thumbnail database.
+typedef std::map<GURL, std::vector<gfx::Size> > IconURLSizesMap;
+
// Defines a favicon bitmap stored in the history backend.
struct FaviconBitmap {
FaviconBitmap();
@@ -817,6 +829,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