| 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..55654e7d3ea94e7bb11b9ef397e1e9ef47181c9a 100644
|
| --- a/chrome/browser/favicon/favicon_service.cc
|
| +++ b/chrome/browser/favicon/favicon_service.cc
|
| @@ -23,10 +23,16 @@ FaviconService::Handle FaviconService::GetFavicon(
|
| AddRequest(request, consumer);
|
| HistoryService* hs =
|
| HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| - if (hs)
|
| - hs->GetFavicon(request, icon_url, icon_type);
|
| - else
|
| + // There should only ever be a single favicon per page URL and
|
| + // history::IconType so the returned FaviconData should only have a single
|
| + // element.
|
| + if (hs) {
|
| + std::vector<GURL> icon_urls;
|
| + icon_urls.push_back(icon_url);
|
| + hs->GetFavicons(request, icon_urls, icon_type);
|
| + } else {
|
| ForwardEmptyResultAsync(request);
|
| + }
|
| return request->handle();
|
| }
|
|
|
| @@ -40,10 +46,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 +71,22 @@ 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 page URL for icon type
|
| + // FAVICON so the returned FaviconData should have a single element.
|
| + hs->GetFaviconsForURL(request, page_url, icon_types);
|
| + } 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,
|
| @@ -102,7 +94,7 @@ void FaviconService::CloneFavicon(const GURL& old_page_url,
|
| HistoryService* hs =
|
| HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| if (hs)
|
| - hs->CloneFavicon(old_page_url, new_page_url);
|
| + hs->CloneFavicons(old_page_url, new_page_url);
|
| }
|
|
|
| void FaviconService::SetImportedFavicons(
|
| @@ -119,8 +111,19 @@ 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) {
|
| + // TODO(pkotwicz): Pass in real pixel size to SetFavicons.
|
| + history::FaviconDataElement element;
|
| + element.bitmap_data = scoped_refptr<base::RefCountedMemory>(
|
| + new base::RefCountedBytes(image_data));
|
| + 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() {
|
|
|