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

Unified Diff: chrome/browser/ui/views/ash/balloon_view_ash.cc

Issue 11411180: move favicon download code from chrome/ into content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix order Created 8 years 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/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..c0ea83facb420d031f3bf4c2ce5be7fe1652d4fc 100644
--- a/chrome/browser/ui/views/ash/balloon_view_ash.cc
+++ b/chrome/browser/ui/views/ash/balloon_view_ash.cc
@@ -9,12 +9,10 @@
#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"
@@ -39,7 +37,8 @@ message_center::MessageCenter* GetMessageCenter() {
BalloonViewAsh::BalloonViewAsh(BalloonCollection* collection)
: collection_(collection),
- balloon_(NULL) {
+ balloon_(NULL),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
}
BalloonViewAsh::~BalloonViewAsh() {
@@ -90,6 +89,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 +122,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,
+ weak_ptr_factory_.GetWeakPtr()));
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();
« no previous file with comments | « chrome/browser/ui/views/ash/balloon_view_ash.h ('k') | chrome/browser/ui/views/create_application_shortcut_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698