Index: chrome/browser/favicon/favicon_service.cc |
diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc |
index 3621b407d224b6c42ca0ad274a3153c8d3756c21..0455583e20f2b79474504d9a3ea56b1f475dba3b 100644 |
--- a/chrome/browser/favicon/favicon_service.cc |
+++ b/chrome/browser/favicon/favicon_service.cc |
@@ -23,10 +23,18 @@ 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 |
+ if (hs) { |
+ // There should only ever be a single favicon per page URL and |
+ // history::IconType so the returned FaviconData should only have a |
+ // single bitmap and the passed in |desired_dip_size| and |
+ // |desired_scale_factors| shouldn't matter. |
+ std::vector<GURL> icon_urls; |
+ icon_urls.push_back(icon_url); |
+ hs->GetFavicon(request, icon_urls, icon_type, gfx::Size(), |
+ ui::GetSupportedScaleFactors()); |
+ } else { |
ForwardEmptyResultAsync(request); |
+ } |
return request->handle(); |
} |
@@ -40,10 +48,18 @@ 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) { |
+ // There should only ever be a single favicon per page URL and |
+ // history::IconType so the returned FaviconData should only have a |
+ // single bitmap and the passed in |desired_dip_size| and |
+ // |desired_scale_factors| shouldn't matter. |
+ std::vector<GURL> icon_urls; |
+ icon_urls.push_back(icon_url); |
+ hs->UpdateFaviconMappingsAndFetch(request, page_url, icon_urls, icon_type, |
+ gfx::Size(), ui::GetSupportedScaleFactors()); |
+ } else { |
ForwardEmptyResultAsync(request); |
+ } |
return request->handle(); |
} |
@@ -62,10 +78,16 @@ 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 and |
+ // the passed in |desired_dip_size| and |desired_scale_factors| shouldn't |
+ // matter. |
+ hs->GetFaviconForURL(request, page_url, icon_types, gfx::Size(), |
+ ui::GetSupportedScaleFactors()); |
+ } else { |
ForwardEmptyResultAsync(request); |
+ } |
} |
return handle; |
} |
@@ -74,7 +96,7 @@ 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, |
@@ -82,7 +104,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( |
@@ -99,8 +121,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::FaviconBitmapData favicon_bitmap_data; |
+ favicon_bitmap_data.bitmap_data = scoped_refptr<base::RefCountedMemory>( |
+ new base::RefCountedBytes(image_data)); |
+ favicon_bitmap_data.pixel_size = gfx::Size(); |
+ std::vector<history::FaviconBitmapData> favicon_bitmaps; |
+ favicon_bitmaps.push_back(favicon_bitmap_data); |
+ history::IconURLSizesMap icon_url_sizes; |
+ icon_url_sizes[icon_url].push_back(gfx::Size()); |
+ hs->SetFavicons(page_url, icon_url, icon_type, favicon_bitmaps, |
+ icon_url_sizes); |
+ } |
} |
FaviconService::~FaviconService() { |