diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-28 20:12:55 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-28 20:12:55 +0000 |
commit | 8655122b4e38f645838cdb53dcecdaf8da3ca3f1 (patch) | |
tree | 27d0f8b24f2dd4306506e29c8357d63c03a1d65d /chrome/browser/jumplist_win.cc | |
parent | ecf652e0ab0b625276e2b9cc1a435ff865fb5e51 (diff) | |
download | chromium_src-8655122b4e38f645838cdb53dcecdaf8da3ca3f1.zip chromium_src-8655122b4e38f645838cdb53dcecdaf8da3ca3f1.tar.gz chromium_src-8655122b4e38f645838cdb53dcecdaf8da3ca3f1.tar.bz2 |
Revert 153695 - Change FaviconData to be able to return data for multiple bitmaps for same icon URL.
Add methods to FaviconService to get gfx::Image more easily
from Favicon.
Remove unused FaviconService::GetFaviconForID().
BUG=138553
Test=Compiles, FaviconHandlerTest.* pass.
Review URL: https://chromiumcodereview.appspot.com/10870022
TBR=pkotwicz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10891007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jumplist_win.cc')
-rw-r--r-- | chrome/browser/jumplist_win.cc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 7c0a6a0..d66c0da 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -44,7 +44,6 @@ #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; @@ -702,15 +701,15 @@ bool JumpList::StartLoadingFavicon() { } FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); - handle_ = favicon_service->GetFaviconImageForURL( - profile_, url, history::FAVICON, gfx::kFaviconSize, &favicon_consumer_, + handle_ = favicon_service->GetFaviconForURL( + profile_, url, history::FAVICON, &favicon_consumer_, base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this))); return true; } void JumpList::OnFaviconDataAvailable( FaviconService::Handle handle, - const history::FaviconImageResult& image_result) { + history::FaviconData favicon) { // 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; @@ -719,9 +718,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 (!image_result.image.IsEmpty()) { + if (favicon.is_valid()) { if (!icon_urls_.empty() && icon_urls_.front().second) - icon_urls_.front().second->SetIconData(image_result.image.AsBitmap()); + icon_urls_.front().second->SetIconData(favicon.image_data); } if (!icon_urls_.empty()) @@ -765,11 +764,11 @@ void JumpList::RunUpdate() { file_util::CreateDirectory(icon_dir_); // Create temporary icon files for shortcuts in the "Most Visited" category. - CreateIconFiles(local_most_visited_pages); + DecodeIconData(local_most_visited_pages); // Create temporary icon files for shortcuts in the "Recently Closed" // category. - CreateIconFiles(local_recently_closed_pages); + DecodeIconData(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 @@ -778,11 +777,17 @@ void JumpList::RunUpdate() { local_recently_closed_pages); } -void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { +void JumpList::DecodeIconData(const ShellLinkItemList& item_list) { for (ShellLinkItemList::const_iterator item = item_list.begin(); item != item_list.end(); ++item) { - FilePath icon_path; - if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) - (*item)->SetIcon(icon_path.value(), 0, true); + 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); + } } } |