| Index: chrome/browser/favicon/favicon_service.cc
|
| diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc
|
| index 6c55b307fd75475ad91d8a8448a4aa5aa5b421dd..0134e96a593d3641c68dca18940618172d7a91b8 100644
|
| --- a/chrome/browser/favicon/favicon_service.cc
|
| +++ b/chrome/browser/favicon/favicon_service.cc
|
| @@ -23,8 +23,10 @@ FaviconService::Handle FaviconService::GetFavicon(
|
| AddRequest(request, consumer);
|
| HistoryService* hs =
|
| HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + // There should only ever be a single favicon per history::IconType so
|
| + // the requested size does not matter.
|
| if (hs)
|
| - hs->GetFavicon(request, icon_url, icon_type);
|
| + hs->GetFaviconClosestToSize(request, icon_url, icon_type, gfx::Size());
|
| else
|
| ForwardEmptyResultAsync(request);
|
| return request->handle();
|
| @@ -40,10 +42,13 @@ FaviconService::Handle FaviconService::UpdateFaviconMappingAndFetch(
|
| AddRequest(request, consumer);
|
| HistoryService* hs =
|
| HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| - if (hs)
|
| - hs->UpdateFaviconMappingAndFetch(request, page_url, icon_url, icon_type);
|
| - else
|
| + if (hs) {
|
| + std::vector<GURL> icon_urls;
|
| + icon_urls.push_back(icon_url);
|
| + hs->UpdateFaviconMappingsAndFetch(request, page_url, icon_urls, icon_type);
|
| + } else {
|
| ForwardEmptyResultAsync(request);
|
| + }
|
| return request->handle();
|
| }
|
|
|
| @@ -62,39 +67,23 @@ FaviconService::Handle FaviconService::GetFaviconForURL(
|
| } else {
|
| HistoryService* hs = HistoryServiceFactory::GetForProfile(
|
| profile_, Profile::EXPLICIT_ACCESS);
|
| - if (hs)
|
| - hs->GetFaviconForURL(request, page_url, icon_types);
|
| - else
|
| + if (hs) {
|
| + // There should only ever be a single favicon per history::IconType so
|
| + // the requested size does not matter.
|
| + hs->GetFaviconForURLClosestToSize(request, page_url, icon_types,
|
| + gfx::Size());
|
| + } else {
|
| ForwardEmptyResultAsync(request);
|
| + }
|
| }
|
| return handle;
|
| }
|
|
|
| -// Requests the favicon for |favicon_id|. The |consumer| is notified when the
|
| -// bits have been fetched.
|
| -FaviconService::Handle FaviconService::GetFaviconForID(
|
| - history::FaviconID favicon_id,
|
| - CancelableRequestConsumerBase* consumer,
|
| - const FaviconDataCallback& callback) {
|
| - GetFaviconRequest* request = new GetFaviconRequest(callback);
|
| - AddRequest(request, consumer);
|
| - FaviconService::Handle handle = request->handle();
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| - if (hs)
|
| - hs->GetFaviconForID(request, favicon_id);
|
| - else
|
| - ForwardEmptyResultAsync(request);
|
| -
|
| - return handle;
|
| -}
|
| -
|
| -
|
| void FaviconService::SetFaviconOutOfDateForPage(const GURL& page_url) {
|
| HistoryService* hs =
|
| HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| if (hs)
|
| - hs->SetFaviconOutOfDateForPage(page_url);
|
| + hs->SetFaviconsOutOfDateForPage(page_url);
|
| }
|
|
|
| void FaviconService::CloneFavicon(const GURL& old_page_url,
|
| @@ -119,8 +108,21 @@ void FaviconService::SetFavicon(const GURL& page_url,
|
| history::IconType icon_type) {
|
| HistoryService* hs =
|
| HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| - if (hs)
|
| - hs->SetFavicon(page_url, icon_url, image_data, icon_type);
|
| + if (hs) {
|
| + history::FaviconDataElement element;
|
| + element.bitmap_data = scoped_refptr<base::RefCountedMemory>(
|
| + new base::RefCountedBytes(image_data));
|
| + // As there should be only a single favicon per history::IconType the size
|
| + // we use for inserting the favicon does not matter as long as the same
|
| + // size is used for inserting everywhere.
|
| + element.pixel_size = gfx::Size();
|
| + element.icon_url = icon_url;
|
| + std::vector<history::FaviconDataElement> elements;
|
| + elements.push_back(element);
|
| + history::IconURLSizesMap icon_url_sizes;
|
| + icon_url_sizes[icon_url].InsertSize(gfx::Size());
|
| + hs->SetFavicons(page_url, icon_type, elements, icon_url_sizes);
|
| + }
|
| }
|
|
|
| FaviconService::~FaviconService() {
|
|
|