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

Unified Diff: chrome/browser/ui/toolbar/back_forward_menu_model.cc

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/ui/toolbar/back_forward_menu_model.cc
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
index 3c343f5a3906da44071453d53648e296653aeda4..83135f2241a031f4df42ebd247424c907fa86d8e 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
@@ -31,7 +31,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/text/text_elider.h"
-#include "ui/gfx/codec/png_codec.h"
+#include "ui/gfx/favicon_size.h"
using content::NavigationController;
using content::NavigationEntry;
@@ -250,8 +250,9 @@ void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) {
browser_->profile(), Profile::EXPLICIT_ACCESS);
if (!favicon_service)
return;
- FaviconService::Handle handle = favicon_service->GetFaviconForURL(
- browser_->profile(), entry->GetURL(), history::FAVICON, &load_consumer_,
+ FaviconService::Handle handle = favicon_service->GetFaviconImageForURL(
+ browser_->profile(), entry->GetURL(), history::FAVICON,
+ gfx::kFaviconSize, &load_consumer_,
base::Bind(&BackForwardMenuModel::OnFavIconDataAvailable,
base::Unretained(this)));
load_consumer_.SetClientData(favicon_service, handle, entry->GetUniqueID());
@@ -259,8 +260,8 @@ void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) {
void BackForwardMenuModel::OnFavIconDataAvailable(
FaviconService::Handle handle,
- history::FaviconData favicon) {
- if (favicon.is_valid()) {
+ const history::FaviconImageResult& image_result) {
+ if (!image_result.image.IsEmpty()) {
int unique_id = load_consumer_.GetClientDataForCurrentRequest();
// Find the current model_index for the unique_id.
NavigationEntry* entry = NULL;
@@ -283,16 +284,13 @@ void BackForwardMenuModel::OnFavIconDataAvailable(
// Now that we have a valid NavigationEntry, decode the favicon and assign
// it to the NavigationEntry.
- gfx::Image icon(favicon.image_data->front(), favicon.image_data->size());
- if (!icon.IsEmpty()) {
- entry->GetFavicon().valid = true;
- entry->GetFavicon().url = favicon.icon_url;
- // TODO: Once the history service returns more representations,
- // use them all instead of having just the lodpi favicon.
- entry->GetFavicon().image = icon;
- if (menu_model_delegate()) {
- menu_model_delegate()->OnIconChanged(model_index);
- }
+ entry->GetFavicon().valid = true;
+ entry->GetFavicon().url = image_result.icon_url;
+ // TODO: Once the history service returns more representations,
+ // use them all instead of having just the lodpi favicon.
+ entry->GetFavicon().image = image_result.image;
+ if (menu_model_delegate()) {
+ menu_model_delegate()->OnIconChanged(model_index);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698