summaryrefslogtreecommitdiffstats
path: root/chrome/browser/status_icons/desktop_notification_balloon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/status_icons/desktop_notification_balloon.cc')
-rw-r--r--chrome/browser/status_icons/desktop_notification_balloon.cc26
1 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/status_icons/desktop_notification_balloon.cc b/chrome/browser/status_icons/desktop_notification_balloon.cc
index d49a8bb..fb22c91 100644
--- a/chrome/browser/status_icons/desktop_notification_balloon.cc
+++ b/chrome/browser/status_icons/desktop_notification_balloon.cc
@@ -67,28 +67,22 @@ DesktopNotificationBalloon::DesktopNotificationBalloon() {
}
DesktopNotificationBalloon::~DesktopNotificationBalloon() {
- if (notification_.get())
- CloseBalloon(notification_->notification_id());
+ if (!notification_id_.empty())
+ CloseBalloon(notification_id_);
}
void DesktopNotificationBalloon::DisplayBalloon(const SkBitmap& icon,
const string16& title,
const string16& contents) {
- GURL icon_url;
- if (!icon.empty())
- icon_url = GURL(web_ui_util::GetImageDataUrl(gfx::ImageSkia(icon)));
-
- GURL content_url(DesktopNotificationService::CreateDataUrl(
- icon_url, title, contents, WebKit::WebTextDirectionDefault));
-
- notification_.reset(new Notification(
- GURL(), content_url, string16(), string16(),
- new DummyNotificationDelegate(base::IntToString(id_count_++))));
-
// Allowing IO access is required here to cover the corner case where
// there is no last used profile and the default one is loaded.
// IO access won't be required for normal uses.
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- g_browser_process->notification_ui_manager()->Add(
- *notification_.get(), ProfileManager::GetLastUsedProfile());
+ Profile* profile;
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ profile = ProfileManager::GetLastUsedProfile();
+ }
+ notification_id_ = DesktopNotificationService::AddIconNotification(
+ GURL(), title, contents, gfx::ImageSkia(icon),
+ new DummyNotificationDelegate(base::IntToString(id_count_++)), profile);
}