| Index: chrome/browser/history/history.h
|
| diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h
|
| index 69fda8bc97b9ddd6773302bc72290e5b8c5eef6b..de15d0ae783edb9ccf5d4a2dff808277ad10289f 100644
|
| --- a/chrome/browser/history/history.h
|
| +++ b/chrome/browser/history/history.h
|
| @@ -686,30 +686,68 @@ class HistoryService : public CancelableRequestProvider,
|
| // these methods directly you should call the respective method on the
|
| // FaviconService.
|
|
|
| - // Used by the FaviconService to get a favicon from the history backend.
|
| - void GetFavicon(FaviconService::GetFaviconRequest* request,
|
| - const GURL& icon_url,
|
| + // Used by the FaviconService to get the favicon bitmap from the history
|
| + // backend whose size is closest to |pixel_size|.
|
| + void GetFaviconClosestToSize(FaviconService::GetFaviconRequest* request,
|
| + const GURL& icon_url,
|
| + history::IconType icon_type,
|
| + const gfx::Size& pixel_size);
|
| +
|
| + // Used by FaviconService to get all the favicon bitmaps from the history
|
| + // backend for the favicons at |icon_urls|.
|
| + void GetFavicons(FaviconService::GetFaviconRequest* request,
|
| + const std::vector<GURL>& icon_urls,
|
| history::IconType icon_type);
|
|
|
| - // Used by the FaviconService to update the favicon mappings on the history
|
| - // backend.
|
| - void UpdateFaviconMappingAndFetch(FaviconService::GetFaviconRequest* request,
|
| - const GURL& page_url,
|
| - const GURL& icon_url,
|
| - 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,
|
| - int icon_types);
|
| + // Used by the FaviconService to get the favicon bitmap mapped to |page_url|
|
| + // from the history backend whose size is closest to |pixel_size|.
|
| + void GetFaviconForURLClosestToSize(FaviconService::GetFaviconRequest* request,
|
| + const GURL& page_url,
|
| + int icon_types,
|
| + const gfx::Size& pixel_size);
|
|
|
| - // Used by the FaviconService to get a favicon from the history backend.
|
| - void GetFaviconForID(FaviconService::GetFaviconRequest* request,
|
| - history::FaviconID id);
|
| + // Used by the FaviconService to get all the favicons mapped to |page_url|
|
| + // from the history backend.
|
| + void GetFaviconsForURL(FaviconService::GetFaviconRequest* request,
|
| + const GURL& page_url,
|
| + int icon_types);
|
|
|
| - // Used by the FaviconService to mark the favicon for the page as being out
|
| + // Used by the FaviconService to update the favicon mappings on the history
|
| + // backend.
|
| + void UpdateFaviconMappingsAndFetch(FaviconService::GetFaviconRequest* request,
|
| + const GURL& page_url,
|
| + const std::vector<GURL>& icon_urls,
|
| + history::IconType icon_type);
|
| +
|
| + // Used by the FaviconService to add favicons for a page on the history
|
| + // backend. This method queries for the IconURLSizesMap from |page_url|. If
|
| + // unavailable, a guess at what IconURLSizesMap should be is used. This
|
| + // function is inefficient. Do not use if at all possible.
|
| + // TODO(pkotwicz): Remove this function once it is no longer required by
|
| + // sync.
|
| + void AddFavicons(const GURL& page_url,
|
| + history::IconType icon_type,
|
| + const std::vector<history::FaviconDataElement>& elements);
|
| +
|
| + // Used by the FaviconService to set the favicons for a page on the history
|
| + // backend.
|
| + // |elements| is a listing of additional favicon bitmaps to store for
|
| + // |page_url|.
|
| + // |icon_url_sizes| is a mapping of all the icon urls of favicons available
|
| + // for |page_url| to the sizes that those favicons are available at from the
|
| + // web. |elements| does not need to have entries for all the icon urls or
|
| + // sizes listed in |icon_url_sizes|. However, the icon urls and sizes in
|
| + // |elements| must be a subset of |icon_url_sizes|. It is important that
|
| + // |icon_url_sizes| be complete as mappings to favicons whose icon url or
|
| + // pixel size is not in |icon_url_sizes| will be deleted.
|
| + void SetFavicons(const GURL& page_url,
|
| + history::IconType icon_type,
|
| + const std::vector<history::FaviconDataElement>& elements,
|
| + const history::IconURLSizesMap& icon_url_sizes);
|
| +
|
| + // Used by the FaviconService to mark the favicons for the page as being out
|
| // of date.
|
| - void SetFaviconOutOfDateForPage(const GURL& page_url);
|
| + void SetFaviconsOutOfDateForPage(const GURL& page_url);
|
|
|
| // Used by the FaviconService to clone favicons from one page to another,
|
| // provided that other page does not already have favicons.
|
| @@ -721,14 +759,6 @@ class HistoryService : public CancelableRequestProvider,
|
| void SetImportedFavicons(
|
| const std::vector<history::ImportedFaviconUsage>& favicon_usage);
|
|
|
| - // Used by the FaviconService to set the favicon for a page on the history
|
| - // backend.
|
| - void SetFavicon(const GURL& page_url,
|
| - const GURL& icon_url,
|
| - const std::vector<unsigned char>& image_data,
|
| - 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 +875,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 +962,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
|
|
|