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

Unified Diff: chrome/browser/favicon/favicon_handler.cc

Issue 10828127: Use hi-resolution favicon variants if available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: daringfireball hackfix 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/favicon/favicon_handler.cc
diff --git a/chrome/browser/favicon/favicon_handler.cc b/chrome/browser/favicon/favicon_handler.cc
index 41d388c6c8417b5554ef712635583daf6d25cbd0..ff751a9ae96dea517baafa7c3fdf49781214438d 100644
--- a/chrome/browser/favicon/favicon_handler.cc
+++ b/chrome/browser/favicon/favicon_handler.cc
@@ -166,7 +166,8 @@ bool FaviconHandler::UpdateFaviconCandidate(const GURL& url,
bool update_candidate = false;
SkBitmap bitmap = *(image.ToSkBitmap());
int bitmap_size = std::max(bitmap.width(), bitmap.height());
- bool exact_match = (bitmap_size == preferred_icon_size());
+fprintf(stderr, "size: %d %d\n", bitmap_size, preferred_icon_size());
+ bool exact_match = (bitmap_size == preferred_icon_size() || bitmap_size / 2 == preferred_icon_size()); // XXX
if (preferred_icon_size() == 0) {
// No preferred size, use this icon.
update_candidate = true;
@@ -199,7 +200,7 @@ void FaviconHandler::SetFavicon(
const GURL& image_url,
const gfx::Image& image,
history::IconType icon_type) {
- SkBitmap bitmap = *(image.ToSkBitmap());
+ SkBitmap bitmap = *(image.ToSkBitmap()); // XXX
const gfx::Image& sized_image = (preferred_icon_size() == 0 ||
(preferred_icon_size() == bitmap.width() &&
preferred_icon_size() == bitmap.height())) ?
@@ -215,7 +216,8 @@ void FaviconHandler::SetFavicon(
NavigationEntry* entry = GetEntry();
if (entry) {
entry->GetFavicon().url = image_url;
- UpdateFavicon(entry, &sized_image);
+ //UpdateFavicon(entry, &sized_image);
+ UpdateFavicon(entry, &image);
}
}
}
@@ -235,7 +237,8 @@ void FaviconHandler::UpdateFavicon(NavigationEntry* entry,
if (!image)
return;
- entry->GetFavicon().bitmap = *image->ToSkBitmap();
+ entry->GetFavicon().bitmap = *image->ToSkBitmap(); // XXX
+ entry->GetFavicon().image = *image;
delegate_->NotifyFaviconUpdated();
}
@@ -341,7 +344,7 @@ NavigationEntry* FaviconHandler::GetEntry() {
return NULL;
}
-int FaviconHandler::DownloadFavicon(const GURL& image_url, int image_size) {
+int FaviconHandler::DownloadFavicon(const GURL& image_url, const std::vector<int>& image_size) {
if (!image_url.is_valid()) {
NOTREACHED();
return 0;
@@ -443,6 +446,7 @@ void FaviconHandler::OnFaviconDataForInitialURL(
// renderer to download the icon.
}
+// XXX
void FaviconHandler::DownloadFaviconOrAskHistory(
const GURL& page_url,
const GURL& icon_url,
@@ -514,7 +518,10 @@ int FaviconHandler::ScheduleDownload(
int image_size,
history::IconType icon_type,
const FaviconTabHelper::ImageDownloadCallback& callback) {
- const int download_id = DownloadFavicon(image_url, image_size);
+ std::vector<int> sizes;
+ sizes.push_back(image_size);
+ sizes.push_back(2 * image_size); // XXX mac-specific
pkotwicz 2012/08/02 23:47:08 Can you use ui::GetSupportedScaleFactors here inst
+ const int download_id = DownloadFavicon(image_url, sizes);
if (download_id) {
// Download ids should be unique.
DCHECK(download_requests_.find(download_id) == download_requests_.end());

Powered by Google App Engine
This is Rietveld 408576698