Chromium Code Reviews| Index: chrome/browser/ui/views/ash/balloon_view_ash.cc |
| diff --git a/chrome/browser/ui/views/ash/balloon_view_ash.cc b/chrome/browser/ui/views/ash/balloon_view_ash.cc |
| index 0e3d2420085f70d252826c88e91d0bee1e09f516..ae24718bbc6ef69654ad756a73f41b61c30f3044 100644 |
| --- a/chrome/browser/ui/views/ash/balloon_view_ash.cc |
| +++ b/chrome/browser/ui/views/ash/balloon_view_ash.cc |
| @@ -9,20 +9,20 @@ |
| #include "base/logging.h" |
| #include "base/values.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| -#include "chrome/browser/favicon/favicon_download_helper.h" |
| #include "chrome/browser/favicon/favicon_util.h" |
| #include "chrome/browser/notifications/balloon_collection.h" |
| #include "chrome/browser/notifications/notification.h" |
| #include "chrome/browser/profiles/profile.h" |
| -#include "chrome/common/icon_messages.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/site_instance.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_delegate.h" |
| #include "content/public/browser/web_contents_observer.h" |
| +#include "googleurl/src/gurl.h" |
|
jam
2012/12/03 21:59:39
this is pretty redundant to include, by definition
Cait (Slow)
2012/12/04 20:57:35
Done.
|
| #include "ipc/ipc_message.h" |
| #include "ipc/ipc_message_macros.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
|
jam
2012/12/03 21:59:39
ditto
Cait (Slow)
2012/12/04 20:57:35
Done.
|
| #include "ui/gfx/image/image_skia.h" |
| #include "ui/message_center/message_center.h" |
| #include "webkit/glue/image_resource_fetcher.h" |
| @@ -90,6 +90,20 @@ BalloonHost* BalloonViewAsh::GetHost() const { |
| return NULL; |
| } |
| +void BalloonViewAsh::DidDownloadFavicon( |
| + int id, |
| + const GURL& image_url, |
| + bool errored, |
| + int requested_size, |
| + const std::vector<SkBitmap>& bitmaps) { |
| + if (id != current_download_id_ || bitmaps.empty()) |
| + return; |
| + GetMessageCenter()->SetNotificationImage( |
| + cached_notification_id_, gfx::ImageSkia(bitmaps[0])); |
| + current_download_id_ = -1; |
| + cached_notification_id_.clear(); |
| +} |
| + |
| void BalloonViewAsh::FetchIcon(const Notification& notification) { |
| if (!notification.icon().isNull()) { |
| GetMessageCenter()->SetNotificationImage( |
| @@ -109,26 +123,13 @@ void BalloonViewAsh::FetchIcon(const Notification& notification) { |
| LOG(WARNING) << "Notification has icon url but no WebContents"; |
| return; |
| } |
| - icon_fetcher_.reset(new FaviconDownloadHelper(web_contents, this)); |
| - current_download_id_ = icon_fetcher_->DownloadFavicon( |
| - notification.icon_url(), kNotificationIconImageSize); |
| + current_download_id_ = web_contents->DownloadFavicon( |
| + notification.icon_url(), kNotificationIconImageSize, |
| + base::Bind(&BalloonViewAsh::DidDownloadFavicon, |
| + base::Unretained(this))); |
|
jam
2012/12/03 21:59:39
are you sure that this object will outlive web_con
|
| cached_notification_id_ = notification.notification_id(); |
| } |
| -void BalloonViewAsh::OnDidDownloadFavicon( |
| - int id, |
| - const GURL& image_url, |
| - bool errored, |
| - int requested_size, |
| - const std::vector<SkBitmap>& bitmaps) { |
| - if (id != current_download_id_ || bitmaps.empty()) |
| - return; |
| - GetMessageCenter()->SetNotificationImage( |
| - cached_notification_id_, gfx::ImageSkia(bitmaps[0])); |
| - current_download_id_ = -1; |
| - cached_notification_id_.clear(); |
| -} |
| - |
| std::string BalloonViewAsh::GetExtensionId(Balloon* balloon) { |
| ExtensionService* extension_service = |
| balloon_->profile()->GetExtensionService(); |