diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-30 15:43:51 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-30 15:43:51 +0000 |
commit | 65baa222dc4df706827fd8602f9fa38fb76f1fbd (patch) | |
tree | 4aabda67655371f10ddf6be5f0c0e0a6fe8db1f4 /chrome/browser/jumplist_win.cc | |
parent | 5434c3631b104722213ed98c21e95756a132ca7b (diff) | |
download | chromium_src-65baa222dc4df706827fd8602f9fa38fb76f1fbd.zip chromium_src-65baa222dc4df706827fd8602f9fa38fb76f1fbd.tar.gz chromium_src-65baa222dc4df706827fd8602f9fa38fb76f1fbd.tar.bz2 |
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.
BUG=138553
Test=Compiles, FaviconHandlerTest.* pass.
Review URL: https://chromiumcodereview.appspot.com/10870022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154157 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, 12 insertions, 17 deletions
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index d66c0da..7c0a6a0 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); } } |