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

Unified Diff: chrome/browser/history/history.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.h
diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h
index 69fda8bc97b9ddd6773302bc72290e5b8c5eef6b..a60c83a9192181dde85769ebf9acb9e2cdf5cb26 100644
--- a/chrome/browser/history/history.h
+++ b/chrome/browser/history/history.h
@@ -689,6 +689,7 @@ class HistoryService : public CancelableRequestProvider,
// Used by the FaviconService to get a favicon from the history backend.
void GetFavicon(FaviconService::GetFaviconRequest* request,
const GURL& icon_url,
+ const gfx::Size& pixel_size,
history::IconType icon_type);
// Used by the FaviconService to update the favicon mappings on the history
@@ -696,11 +697,13 @@ class HistoryService : public CancelableRequestProvider,
void UpdateFaviconMappingAndFetch(FaviconService::GetFaviconRequest* request,
const GURL& page_url,
const GURL& icon_url,
+ const gfx::Size& pixel_size,
history::IconType icon_type);
// Used by the FaviconService to get a favicon from the history backend.
void GetFaviconForURL(FaviconService::GetFaviconRequest* request,
const GURL& page_url,
+ const gfx::Size& pixel_size,
int icon_types);
// Used by the FaviconService to get a favicon from the history backend.
@@ -723,12 +726,18 @@ class HistoryService : public CancelableRequestProvider,
// Used by the FaviconService to set the favicon for a page on the history
// backend.
+ // |requested size| is the size which was used to search for |image_data|
+ // for which |image_data| is the best match from |page_url|'s favicons.
+ // This does not necessarily correspond to the favicon's pixel size.
+ // For instance, if the ideal favicon size is 16x16 but the best match is
+ // a 10x16 favicon, |requested_size| is 16x16.
+ // TODO(pkotwicz): Add a parameter for the favicon's pixel size.
void SetFavicon(const GURL& page_url,
const GURL& icon_url,
const std::vector<unsigned char>& image_data,
+ const gfx::Size& requested_size,
history::IconType icon_type);
-
// Sets the in-memory URL database. This is called by the backend once the
// database is loaded to make it available.
void SetInMemoryBackend(int backend_id,
@@ -845,6 +854,33 @@ class HistoryService : public CancelableRequestProvider,
return request->handle();
}
+ template<typename BackendFunc,
+ class RequestType, // Descendant of CancelableRequstBase.
+ typename ArgA,
+ typename ArgB,
+ typename ArgC,
+ typename ArgD,
+ typename ArgE>
+ Handle Schedule(SchedulePriority priority,
+ BackendFunc func, // Function to call on the HistoryBackend.
+ CancelableRequestConsumerBase* consumer,
+ RequestType* request,
+ const ArgA& a,
+ const ArgB& b,
+ const ArgC& c,
+ const ArgD& d,
+ const ArgE& e) {
+ DCHECK(thread_) << "History service being called after cleanup";
+ LoadBackendIfNecessary();
+ if (consumer)
+ AddRequest(request, consumer);
+ ScheduleTask(priority,
+ base::Bind(func, history_backend_.get(),
+ scoped_refptr<RequestType>(request),
+ a, b, c, d, e));
+ return request->handle();
+ }
+
// ScheduleAndForget ---------------------------------------------------------
//
// Functions for scheduling operations on the history thread that do not need
@@ -905,6 +941,25 @@ class HistoryService : public CancelableRequestProvider,
a, b, c, d));
}
+ template<typename BackendFunc,
+ typename ArgA,
+ typename ArgB,
+ typename ArgC,
+ typename ArgD,
+ typename ArgE>
+ void ScheduleAndForget(SchedulePriority priority,
+ BackendFunc func, // Function to call on backend.
+ const ArgA& a,
+ const ArgB& b,
+ const ArgC& c,
+ const ArgD& d,
+ const ArgE& e) {
+ DCHECK(thread_) << "History service being called after cleanup";
+ LoadBackendIfNecessary();
+ ScheduleTask(priority, base::Bind(func, history_backend_.get(),
+ a, b, c, d, e));
+ }
+
content::NotificationRegistrar registrar_;
// Some void primitives require some internal processing in the main thread

Powered by Google App Engine
This is Rietveld 408576698