| Index: chrome/browser/ui/views/balloon_view_win.cc
|
| diff --git a/chrome/browser/ui/views/ash/balloon_view_ash.cc b/chrome/browser/ui/views/balloon_view_win.cc
|
| similarity index 84%
|
| copy from chrome/browser/ui/views/ash/balloon_view_ash.cc
|
| copy to chrome/browser/ui/views/balloon_view_win.cc
|
| index 41551debe6365cecb387e0fdc11528a9784fba09..583628a7a0e6b8066c68343564db603130920327 100644
|
| --- a/chrome/browser/ui/views/ash/balloon_view_ash.cc
|
| +++ b/chrome/browser/ui/views/balloon_view_win.cc
|
| @@ -2,16 +2,15 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/ui/views/ash/balloon_view_ash.h"
|
| +#include "chrome/browser/ui/views/balloon_view_win.h"
|
|
|
| -#include "ash/shell.h"
|
| -#include "ash/system/web_notification/web_notification_tray.h"
|
| #include "base/logging.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/favicon/favicon_util.h"
|
| #include "chrome/browser/notifications/balloon_collection.h"
|
| #include "chrome/browser/notifications/notification.h"
|
| +#include "chrome/browser/ui/views/message_center/message_center_tray_host_win.h"
|
| #include "content/public/browser/render_process_host.h"
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/site_instance.h"
|
| @@ -34,7 +33,7 @@ const int kSecondaryIconImageSize = 15;
|
|
|
| // static
|
| message_center::MessageCenter* GetMessageCenter() {
|
| - return ash::Shell::GetInstance()->GetWebNotificationTray()->message_center();
|
| + return ui::MessageCenterTrayHostWin::GetInstance()->message_center();
|
| }
|
|
|
| } // namespace
|
| @@ -42,7 +41,7 @@ message_center::MessageCenter* GetMessageCenter() {
|
| // TODO(dharcourt): Delay showing the notification until all images are
|
| // downloaded, and return an error to the notification creator/API caller
|
| // instead of showing a partial notification if any image download fails.
|
| -class BalloonViewAsh::ImageDownload
|
| +class BalloonViewWin::ImageDownload
|
| : public base::SupportsWeakPtr<ImageDownload> {
|
| public:
|
| // Note that the setter callback passed in will not be called if the image
|
| @@ -67,7 +66,7 @@ class BalloonViewAsh::ImageDownload
|
| DISALLOW_COPY_AND_ASSIGN(ImageDownload);
|
| };
|
|
|
| -BalloonViewAsh::ImageDownload::ImageDownload(const Notification& notification,
|
| +BalloonViewWin::ImageDownload::ImageDownload(const Notification& notification,
|
| const GURL& url,
|
| int size,
|
| const SetImageCallback& callback)
|
| @@ -91,11 +90,10 @@ BalloonViewAsh::ImageDownload::ImageDownload(const Notification& notification,
|
| AsWeakPtr()));
|
| }
|
|
|
| -
|
| -BalloonViewAsh::ImageDownload::~ImageDownload() {
|
| +BalloonViewWin::ImageDownload::~ImageDownload() {
|
| }
|
|
|
| -void BalloonViewAsh::ImageDownload::Downloaded(
|
| +void BalloonViewWin::ImageDownload::Downloaded(
|
| int download_id,
|
| const GURL& image_url,
|
| int requested_size,
|
| @@ -106,16 +104,16 @@ void BalloonViewAsh::ImageDownload::Downloaded(
|
| callback_.Run(image);
|
| }
|
|
|
| -BalloonViewAsh::BalloonViewAsh(BalloonCollection* collection)
|
| +BalloonViewWin::BalloonViewWin(BalloonCollection* collection)
|
| : collection_(collection),
|
| balloon_(NULL) {
|
| }
|
|
|
| -BalloonViewAsh::~BalloonViewAsh() {
|
| +BalloonViewWin::~BalloonViewWin() {
|
| }
|
|
|
| // BalloonView interface.
|
| -void BalloonViewAsh::Show(Balloon* balloon) {
|
| +void BalloonViewWin::Show(Balloon* balloon) {
|
| balloon_ = balloon;
|
| const Notification& notification = balloon_->notification();
|
| notification_id_ = notification.notification_id();
|
| @@ -129,7 +127,7 @@ void BalloonViewAsh::Show(Balloon* balloon) {
|
| DownloadImages(notification);
|
| }
|
|
|
| -void BalloonViewAsh::Update() {
|
| +void BalloonViewWin::Update() {
|
| std::string previous_notification_id = notification_id_;
|
| const Notification& notification = balloon_->notification();
|
| notification_id_ = notification.notification_id();
|
| @@ -141,35 +139,35 @@ void BalloonViewAsh::Update() {
|
| DownloadImages(notification);
|
| }
|
|
|
| -void BalloonViewAsh::RepositionToBalloon() {
|
| +void BalloonViewWin::RepositionToBalloon() {
|
| }
|
|
|
| -void BalloonViewAsh::Close(bool by_user) {
|
| +void BalloonViewWin::Close(bool by_user) {
|
| Notification notification(balloon_->notification());
|
| collection_->OnBalloonClosed(balloon_); // Deletes balloon.
|
| notification.Close(by_user);
|
| GetMessageCenter()->RemoveNotification(notification.notification_id());
|
| }
|
|
|
| -gfx::Size BalloonViewAsh::GetSize() const {
|
| +gfx::Size BalloonViewWin::GetSize() const {
|
| return gfx::Size();
|
| }
|
|
|
| -BalloonHost* BalloonViewAsh::GetHost() const {
|
| +BalloonHost* BalloonViewWin::GetHost() const {
|
| return NULL;
|
| }
|
|
|
| -void BalloonViewAsh::SetNotificationIcon(const std::string& id,
|
| +void BalloonViewWin::SetNotificationIcon(const std::string& id,
|
| const gfx::ImageSkia& image) {
|
| GetMessageCenter()->SetNotificationPrimaryIcon(id, image);
|
| }
|
|
|
| -void BalloonViewAsh::SetNotificationImage(const std::string& id,
|
| +void BalloonViewWin::SetNotificationImage(const std::string& id,
|
| const gfx::ImageSkia& image) {
|
| GetMessageCenter()->SetNotificationImage(id, image);
|
| }
|
|
|
| -void BalloonViewAsh::DownloadImages(const Notification& notification) {
|
| +void BalloonViewWin::DownloadImages(const Notification& notification) {
|
| // Cancel any previous downloads.
|
| downloads_.clear();
|
|
|
| @@ -180,7 +178,7 @@ void BalloonViewAsh::DownloadImages(const Notification& notification) {
|
| downloads_.push_back(linked_ptr<ImageDownload>(new ImageDownload(
|
| notification, notification.icon_url(),
|
| message_center::kNotificationIconWidth,
|
| - base::Bind(&BalloonViewAsh::SetNotificationIcon,
|
| + base::Bind(&BalloonViewWin::SetNotificationIcon,
|
| base::Unretained(this), notification.notification_id()))));
|
| }
|
|
|
| @@ -194,7 +192,7 @@ void BalloonViewAsh::DownloadImages(const Notification& notification) {
|
| downloads_.push_back(linked_ptr<ImageDownload>(new ImageDownload(
|
| notification, GURL(url),
|
| message_center::kNotificationPreferredImageSize,
|
| - base::Bind(&BalloonViewAsh::SetNotificationImage,
|
| + base::Bind(&BalloonViewWin::SetNotificationImage,
|
| base::Unretained(this), notification.notification_id()))));
|
| }
|
| }
|
|
|