Index: chrome/browser/ui/views/balloon_collection_impl_win.cc |
diff --git a/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc b/chrome/browser/ui/views/balloon_collection_impl_win.cc |
similarity index 60% |
copy from chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc |
copy to chrome/browser/ui/views/balloon_collection_impl_win.cc |
index 4cd78e64d4473d0b5b50aabf2470d50e5a77806e..4689018d745105fb6e118aec2a77d64f9ed4266b 100644 |
--- a/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc |
+++ b/chrome/browser/ui/views/balloon_collection_impl_win.cc |
@@ -2,10 +2,8 @@ |
// 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_collection_impl_ash.h" |
+#include "chrome/browser/ui/views/balloon_collection_impl_win.h" |
-#include "ash/shell.h" |
-#include "ash/system/web_notification/web_notification_tray.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/notifications/balloon.h" |
#include "chrome/browser/notifications/desktop_notification_service.h" |
@@ -14,32 +12,35 @@ |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/chrome_pages.h" |
-#include "chrome/browser/ui/views/ash/balloon_view_ash.h" |
+#include "chrome/browser/ui/views/balloon_view_win.h" |
+#include "chrome/browser/ui/views/message_center/message_center_tray_host_win.h" |
#include "chrome/browser/ui/views/notifications/balloon_view_host.h" |
#include "chrome/browser/ui/views/notifications/balloon_view_views.h" |
+#include "ui/message_center/message_center_tray.h" |
+#include "ui/message_center/message_center_tray_host.h" |
-BalloonCollectionImplAsh::BalloonCollectionImplAsh() { |
- ash::Shell::GetInstance()->GetWebNotificationTray()->message_center()-> |
- SetDelegate(this); |
+BalloonCollectionImplWin::BalloonCollectionImplWin() { |
+ ui::MessageCenterTrayHost* host = ui::MessageCenterTrayHostWin::GetInstance(); |
+ host->message_center()->SetDelegate(this); |
} |
-BalloonCollectionImplAsh::~BalloonCollectionImplAsh() { |
+BalloonCollectionImplWin::~BalloonCollectionImplWin() { |
} |
-bool BalloonCollectionImplAsh::HasSpace() const { |
- return true; // Overflow is handled by ash::WebNotificationTray. |
+bool BalloonCollectionImplWin::HasSpace() const { |
+ return true; // Overflow is handled by messagecentertray |
} |
-void BalloonCollectionImplAsh::Add(const Notification& notification, |
+void BalloonCollectionImplWin::Add(const Notification& notification, |
Profile* profile) { |
if (notification.is_html()) |
- return; // HTML notifications are not supported in Ash. |
+ return; // HTML notifications are not supported in Win. |
if (notification.title().empty() && notification.body().empty()) |
return; // Empty notification, don't show. |
return BalloonCollectionImpl::Add(notification, profile); |
} |
-void BalloonCollectionImplAsh::DisableExtension( |
+void BalloonCollectionImplWin::DisableExtension( |
const std::string& notification_id) { |
Balloon* balloon = base().FindBalloonById(notification_id); |
const extensions::Extension* extension = GetBalloonExtension(balloon); |
@@ -49,7 +50,7 @@ void BalloonCollectionImplAsh::DisableExtension( |
extension->id(), extensions::Extension::DISABLE_USER_ACTION); |
} |
-void BalloonCollectionImplAsh::DisableNotificationsFromSource( |
+void BalloonCollectionImplWin::DisableNotificationsFromSource( |
const std::string& notification_id) { |
Balloon* balloon = base().FindBalloonById(notification_id); |
if (!balloon) |
@@ -59,60 +60,40 @@ void BalloonCollectionImplAsh::DisableNotificationsFromSource( |
service->DenyPermission(balloon->notification().origin_url()); |
} |
-void BalloonCollectionImplAsh::NotificationRemoved( |
+void BalloonCollectionImplWin::NotificationRemoved( |
const std::string& notification_id) { |
RemoveById(notification_id); |
} |
-void BalloonCollectionImplAsh::ShowSettings( |
+void BalloonCollectionImplWin::ShowSettings( |
const std::string& notification_id) { |
Balloon* balloon = base().FindBalloonById(notification_id); |
Profile* profile = |
balloon ? balloon->profile() : ProfileManager::GetDefaultProfile(); |
- Browser* browser = |
- chrome::FindOrCreateTabbedBrowser(profile, |
- chrome::HOST_DESKTOP_TYPE_ASH); |
+ Browser* browser = chrome::FindOrCreateTabbedBrowser( |
+ profile, |
+ chrome::HOST_DESKTOP_TYPE_NATIVE); |
if (GetBalloonExtension(balloon)) |
chrome::ShowExtensions(browser); |
else |
chrome::ShowContentSettings(browser, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
} |
-void BalloonCollectionImplAsh::OnClicked(const std::string& notification_id) { |
+void BalloonCollectionImplWin::OnClicked(const std::string& notification_id) { |
Balloon* balloon = base().FindBalloonById(notification_id); |
if (!balloon) |
return; |
balloon->OnClick(); |
} |
-void BalloonCollectionImplAsh::OnButtonClicked( |
+void BalloonCollectionImplWin::OnButtonClicked( |
const std::string& notification_id, int button_index) { |
Balloon* balloon = base().FindBalloonById(notification_id); |
if (balloon) |
balloon->OnButtonClick(button_index); |
} |
-bool BalloonCollectionImplAsh::AddWebUIMessageCallback( |
- const Notification& notification, |
- const std::string& message, |
- const chromeos::BalloonViewHost::MessageCallback& callback) { |
-#if defined(OS_CHROMEOS) |
- Balloon* balloon = base().FindBalloon(notification); |
- if (!balloon) |
- return false; |
- |
- BalloonHost* balloon_host = balloon->balloon_view()->GetHost(); |
- if (!balloon_host) |
- return false; |
- chromeos::BalloonViewHost* balloon_view_host = |
- static_cast<chromeos::BalloonViewHost*>(balloon_host); |
- return balloon_view_host->AddWebUIMessageCallback(message, callback); |
-#else |
- return false; |
-#endif |
-} |
- |
-bool BalloonCollectionImplAsh::UpdateNotification( |
+bool BalloonCollectionImplWin::UpdateNotification( |
const Notification& notification) { |
Balloon* balloon = base().FindBalloon(notification); |
if (!balloon) |
@@ -121,20 +102,20 @@ bool BalloonCollectionImplAsh::UpdateNotification( |
return true; |
} |
-bool BalloonCollectionImplAsh::UpdateAndShowNotification( |
+bool BalloonCollectionImplWin::UpdateAndShowNotification( |
const Notification& notification) { |
return UpdateNotification(notification); |
} |
-Balloon* BalloonCollectionImplAsh::MakeBalloon( |
+Balloon* BalloonCollectionImplWin::MakeBalloon( |
const Notification& notification, Profile* profile) { |
Balloon* balloon = new Balloon(notification, profile, this); |
- BalloonViewAsh* balloon_view = new BalloonViewAsh(this); |
+ BalloonViewWin* balloon_view = new BalloonViewWin(this); |
balloon->set_view(balloon_view); |
return balloon; |
} |
-const extensions::Extension* BalloonCollectionImplAsh::GetBalloonExtension( |
+const extensions::Extension* BalloonCollectionImplWin::GetBalloonExtension( |
Balloon* balloon) { |
if (!balloon) |
return NULL; |
@@ -145,9 +126,9 @@ const extensions::Extension* BalloonCollectionImplAsh::GetBalloonExtension( |
ExtensionURLInfo(origin)); |
} |
-#if defined(OS_CHROMEOS) |
+#if defined(OS_WIN) |
// static |
BalloonCollection* BalloonCollection::Create() { |
- return new BalloonCollectionImplAsh(); |
+ return new BalloonCollectionImplWin(); |
} |
#endif |