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

Unified Diff: chrome/browser/ui/search_engines/template_url_table_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/search_engines/template_url_table_model.cc
diff --git a/chrome/browser/ui/search_engines/template_url_table_model.cc b/chrome/browser/ui/search_engines/template_url_table_model.cc
index 8a1587bbae8c90224a08d4fccd6a59be3336cc17..0e4aa91f8d4337d989b0b05c016b288987c8099c 100644
--- a/chrome/browser/ui/search_engines/template_url_table_model.cc
+++ b/chrome/browser/ui/search_engines/template_url_table_model.cc
@@ -20,7 +20,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/table_model_observer.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/codec/png_codec.h"
+#include "ui/gfx/favicon_size.h"
#include "ui/gfx/image/image_skia.h"
// Group IDs used by TemplateURLTableModel.
@@ -63,7 +63,7 @@ class ModelEntry {
// fetched again. This should be invoked if the url is modified.
void ResetIcon() {
load_state_ = NOT_LOADED;
- favicon_ = SkBitmap();
+ favicon_ = gfx::ImageSkia();
}
private:
@@ -92,25 +92,24 @@ class ModelEntry {
return;
}
load_state_ = LOADING;
- favicon_service->GetFavicon(favicon_url, history::FAVICON,
- &request_consumer_,
+ favicon_service->GetFaviconImage(favicon_url, history::FAVICON,
+ gfx::kFaviconSize, &request_consumer_,
base::Bind(&ModelEntry::OnFaviconDataAvailable,
base::Unretained(this)));
}
void OnFaviconDataAvailable(
FaviconService::Handle handle,
- history::FaviconData favicon) {
+ const history::FaviconImageResult& image_result) {
load_state_ = LOADED;
- if (favicon.is_valid() && gfx::PNGCodec::Decode(favicon.image_data->front(),
- favicon.image_data->size(),
- &favicon_)) {
+ if (!image_result.image.IsEmpty()) {
+ favicon_ = image_result.image.AsImageSkia();
model_->FaviconAvailable(this);
}
}
TemplateURL* template_url_;
- SkBitmap favicon_;
+ gfx::ImageSkia favicon_;
LoadState load_state_;
TemplateURLTableModel* model_;
CancelableRequestConsumer request_consumer_;

Powered by Google App Engine
This is Rietveld 408576698