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

Unified Diff: ash/system/web_notification/web_notification_tray.h

Issue 11819048: Implement message center on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address sky/msw comments + rebase. Created 7 years, 11 months 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
« no previous file with comments | « no previous file | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/web_notification/web_notification_tray.h
diff --git a/ash/system/web_notification/web_notification_tray.h b/ash/system/web_notification/web_notification_tray.h
index bd9e026af42db40d4f0ee85a98afbf0ecfd4d8ee..585f45761357e916d1aa9b3d488b6caec0892fe4 100644
--- a/ash/system/web_notification/web_notification_tray.h
+++ b/ash/system/web_notification/web_notification_tray.h
@@ -7,10 +7,12 @@
#include "ash/ash_export.h"
#include "ash/system/tray/tray_background_view.h"
-#include "ash/system/tray/tray_views.h"
#include "ash/system/user/login_status.h"
#include "base/gtest_prod_util.h"
-#include "ui/message_center/message_center.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/message_center/message_center_tray.h"
+#include "ui/message_center/message_center_tray_delegate.h"
+#include "ui/views/bubble/tray_bubble_view.h"
#include "ui/views/widget/widget_observer.h"
// Status area tray for showing browser and app notifications. This hosts
@@ -21,24 +23,11 @@
// generated by SystemTrayItem). Visibility of one notification type or other
// is controlled by StatusAreaWidget.
-namespace aura {
-class LocatedEvent;
-}
-
-namespace gfx {
-class ImageSkia;
-}
-
-namespace views {
-class ImageButton;
-class TrayBubbleView;
-class Widget;
-}
-
namespace message_center {
+class MessageBubbleBase;
+class MessageCenter;
class MessageCenterBubble;
class MessagePopupBubble;
-class QuietModeBubble;
}
namespace ash {
@@ -51,11 +40,12 @@ class WebNotificationBubbleWrapper;
class ASH_EXPORT WebNotificationTray
: public internal::TrayBackgroundView,
public views::TrayBubbleView::Delegate,
- public message_center::MessageCenter::Observer,
+ public message_center::MessageCenterTrayDelegate,
public views::ButtonListener,
public views::WidgetObserver {
public:
- explicit WebNotificationTray(internal::StatusAreaWidget* status_area_widget);
+ explicit WebNotificationTray(
+ internal::StatusAreaWidget* status_area_widget);
virtual ~WebNotificationTray();
// Set whether or not the popup notifications should be hidden.
@@ -73,10 +63,6 @@ class ASH_EXPORT WebNotificationTray
// Returns true if the mouse is inside the notification bubble.
bool IsMouseInNotificationBubble() const;
- message_center::MessageCenter* message_center() {
- return message_center_;
- }
-
// Overridden from TrayBackgroundView.
virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
virtual void AnchorUpdated() OVERRIDE;
@@ -98,9 +84,6 @@ class ASH_EXPORT WebNotificationTray
AnchorAlignment anchor_alignment) OVERRIDE;
virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE;
- // Overridden from message_center::MessageCenter::Observer.
- virtual void OnMessageCenterChanged(bool new_notification) OVERRIDE;
-
// Overridden from ButtonListener.
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
@@ -108,6 +91,17 @@ class ASH_EXPORT WebNotificationTray
// Overridden from WidgetObserver.
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ // Overridden from MessageCenterTrayDelegate.
+ virtual void OnMessageCenterTrayChanged() OVERRIDE;
+ virtual bool ShowMessageCenter() OVERRIDE;
+ virtual void UpdateMessageCenter() OVERRIDE;
+ virtual void HideMessageCenter() OVERRIDE;
+ virtual bool ShowPopups() OVERRIDE;
+ virtual void UpdatePopups() OVERRIDE;
+ virtual void HidePopups() OVERRIDE;
+
+ message_center::MessageCenter* message_center();
+
private:
FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications);
FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble);
@@ -115,29 +109,16 @@ class ASH_EXPORT WebNotificationTray
ManyMessageCenterNotifications);
FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, ManyPopupNotifications);
- // Shows or hides the message center bubble.
- void ToggleMessageCenterBubble();
-
- // Shows or updates the message center bubble and hides the popup bubble.
- void ShowMessageCenterBubble();
+ // Queries login status and the status area widget to determine visibility of
+ // the message center.
+ bool ShouldShowMessageCenter();
- // Hides the message center bubble if visible.
- void HideMessageCenterBubble();
-
- // Shows or updates the popup notification bubble if appropriate.
- void ShowPopupBubble();
-
- // Hides the notification bubble if visible.
- void HidePopupBubble();
-
- // Returns true if it should show the quiet mode bubble.
+ // Returns true if it should show the quiet mode bubble.
bool ShouldShowQuietModeBubble(const ui::Event& event);
// Shows the quiet mode bubble.
void ShowQuietModeBubble();
- // Updates the tray icon and visibility.
- void UpdateTray();
internal::WebNotificationBubbleWrapper* message_center_bubble() const {
return message_center_bubble_.get();
@@ -152,14 +133,16 @@ class ASH_EXPORT WebNotificationTray
}
// Testing accessors.
+ bool IsPopupVisible() const;
message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
message_center::MessagePopupBubble* GetPopupBubbleForTest();
- message_center::MessageCenter* message_center_; // Weak, owned by ash::Shell
+ scoped_ptr<message_center::MessageCenterTray> message_center_tray_;
scoped_ptr<internal::WebNotificationBubbleWrapper> message_center_bubble_;
scoped_ptr<internal::WebNotificationBubbleWrapper> popup_bubble_;
scoped_ptr<message_center::QuietModeBubble> quiet_mode_bubble_;
views::ImageButton* button_;
+
bool show_message_center_on_unlock_;
DISALLOW_COPY_AND_ASSIGN(WebNotificationTray);
« no previous file with comments | « no previous file | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698