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

Unified Diff: chrome/browser/jumplist_win.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/jumplist_win.cc
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc
index d66c0da0a33b8df140a27b6d6801273b43772802..7c0a6a02e6dc14d2d7ba1e097775ffb6643552d2 100644
--- a/chrome/browser/jumplist_win.cc
+++ b/chrome/browser/jumplist_win.cc
@@ -44,6 +44,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/codec/png_codec.h"
+#include "ui/gfx/favicon_size.h"
#include "ui/gfx/icon_util.h"
using content::BrowserThread;
@@ -701,15 +702,15 @@ bool JumpList::StartLoadingFavicon() {
}
FaviconService* favicon_service =
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- handle_ = favicon_service->GetFaviconForURL(
- profile_, url, history::FAVICON, &favicon_consumer_,
+ handle_ = favicon_service->GetFaviconImageForURL(
+ profile_, url, history::FAVICON, gfx::kFaviconSize, &favicon_consumer_,
base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)));
return true;
}
void JumpList::OnFaviconDataAvailable(
FaviconService::Handle handle,
- history::FaviconData favicon) {
+ const history::FaviconImageResult& image_result) {
// If there is currently a favicon request in progress, it is now outdated,
// as we have received another, so nullify the handle from the old request.
handle_ = NULL;
@@ -718,9 +719,9 @@ void JumpList::OnFaviconDataAvailable(
base::AutoLock auto_lock(list_lock_);
// Attach the received data to the ShellLinkItem object.
// This data will be decoded by the RunUpdate method.
- if (favicon.is_valid()) {
+ if (!image_result.image.IsEmpty()) {
if (!icon_urls_.empty() && icon_urls_.front().second)
- icon_urls_.front().second->SetIconData(favicon.image_data);
+ icon_urls_.front().second->SetIconData(image_result.image.AsBitmap());
}
if (!icon_urls_.empty())
@@ -764,11 +765,11 @@ void JumpList::RunUpdate() {
file_util::CreateDirectory(icon_dir_);
// Create temporary icon files for shortcuts in the "Most Visited" category.
- DecodeIconData(local_most_visited_pages);
+ CreateIconFiles(local_most_visited_pages);
// Create temporary icon files for shortcuts in the "Recently Closed"
// category.
- DecodeIconData(local_recently_closed_pages);
+ CreateIconFiles(local_recently_closed_pages);
// We finished collecting all resources needed for updating an appliation
// JumpList. So, create a new JumpList and replace the current JumpList
@@ -777,17 +778,11 @@ void JumpList::RunUpdate() {
local_recently_closed_pages);
}
-void JumpList::DecodeIconData(const ShellLinkItemList& item_list) {
+void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) {
for (ShellLinkItemList::const_iterator item = item_list.begin();
item != item_list.end(); ++item) {
- SkBitmap icon_bitmap;
- if ((*item)->data().get() &&
- gfx::PNGCodec::Decode((*item)->data()->front(),
- (*item)->data()->size(),
- &icon_bitmap)) {
- FilePath icon_path;
- if (CreateIconFile(icon_bitmap, icon_dir_, &icon_path))
- (*item)->SetIcon(icon_path.value(), 0, true);
- }
+ FilePath icon_path;
+ if (CreateIconFile((*item)->data(), icon_dir_, &icon_path))
+ (*item)->SetIcon(icon_path.value(), 0, true);
}
}

Powered by Google App Engine
This is Rietveld 408576698