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

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

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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_backend.h
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h
index 6d50cc18f68ebc0dcb8f6be4751bcbb7353e24af..4ebf97380fd9c47334838d9fd01a8225b88f4691 100644
--- a/chrome/browser/history/history_backend.h
+++ b/chrome/browser/history/history_backend.h
@@ -40,6 +40,10 @@ class CommitLaterTask;
class HistoryPublisher;
class VisitFilter;
+// The maximum number of favicon bitmaps stored for a single page.
+// Exposed for use in unittests.
+extern const size_t kMaxFaviconsPerPage;
+
// *See the .cc file for more information on the design.*
//
// Internal history implementation which does most of the work of the history
@@ -250,10 +254,12 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
void GetFavicon(scoped_refptr<GetFaviconRequest> request,
const GURL& icon_url,
+ const gfx::Size& pixel_size,
int icon_types);
void GetFaviconForURL(scoped_refptr<GetFaviconRequest> request,
const GURL& page_url,
+ const gfx::Size& pixel_size,
int icon_types);
void GetFaviconForID(scoped_refptr<GetFaviconRequest> request, FaviconID id);
@@ -261,11 +267,13 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
void SetFavicon(const GURL& page_url,
const GURL& icon_url,
scoped_refptr<base::RefCountedMemory> data,
+ const gfx::Size& pixel_size,
IconType icon_type);
void UpdateFaviconMappingAndFetch(scoped_refptr<GetFaviconRequest> request,
const GURL& page_url,
const GURL& icon_url,
+ const gfx::Size& pixel_size,
IconType icon_type);
void SetFaviconOutOfDateForPage(const GURL& page_url);
@@ -464,6 +472,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MigrationVisitSource);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MigrationIconMapping);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconMapping);
+ FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExceedPageFaviconLimit);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, AddOrUpdateIconMapping);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetMostRecentVisits);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconForURL);
@@ -587,12 +596,20 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
const GURL* page_url,
const GURL& icon_url,
scoped_refptr<GetFaviconRequest> request,
+ const gfx::Size& requested_size,
int icon_type);
+ // Returns the FaviconID from |favicon_id_size_listing| whose size most
+ // closely matches |desired_pixel_size|.
+ FaviconID GetFaviconID(
+ const std::vector<FaviconIDAndSize>& favicon_id_size_listing,
+ const gfx::Size& desired_pixel_size) const;
+
// Sets the favicon url id for page_url to id. This will also broadcast
// notifications as necessary.
void SetFaviconMapping(const GURL& page_url,
FaviconID id,
+ const gfx::Size& pixel_size,
IconType icon_type);
// Updates the FaviconID associated with the url of a page. If there is an
@@ -602,6 +619,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
// the replaced FaviconID is set in |replaced_icon_id|.
bool AddOrUpdateIconMapping(const GURL& page_url,
FaviconID id,
+ const gfx::Size& pixel_size,
IconType icon_type,
FaviconID* replaced_icon_id);
@@ -650,11 +668,12 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
// If there is a favicon for |page_url| and one of the types in |icon_types|,
// |favicon| is set appropriately and true is returned.
bool GetFaviconFromDB(const GURL& page_url,
+ const gfx::Size& pixel_size,
int icon_types,
FaviconData* favicon);
- // Get favicon by the given |favicon_id|, the |favicon| is set appropriately
- // and true if returned on success, otherwise false is returned.
+ // Get favicon by the given |favicon_id|. The |favicon| is set appropriately.
+ // Returns true on success.
bool GetFaviconFromDB(FaviconID favicon_id, FaviconData* favicon);
// Notify any observers of an addition to the visit database.

Powered by Google App Engine
This is Rietveld 408576698