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

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: Rebase on master @fa1d2262 and rearrange dependencies. 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
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 0ecd334726bdbee3245912f55df022d8098c39d7..3634f7e6bb249eab56227c6143d168e2db8173f9 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_host.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,46 +23,45 @@
// 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 MessageCenterBubble;
-class MessagePopupBubble;
-class QuietModeBubble;
+class MessageCenter;
}
+FORWARD_DECLARE_TEST(WebNotificationTrayTest,
+ ManyMessageCenterNotifications);
+
namespace ash {
namespace internal {
class StatusAreaWidget;
-class WebNotificationBubbleWrapper;
}
class ASH_EXPORT WebNotificationTray
: public internal::TrayBackgroundView,
- public views::TrayBubbleView::Delegate,
- public message_center::MessageCenter::Observer,
+ public ui::MessageCenterTrayHost,
public views::ButtonListener,
public views::WidgetObserver {
public:
- explicit WebNotificationTray(internal::StatusAreaWidget* status_area_widget);
+ explicit WebNotificationTray(
+ internal::StatusAreaWidget* status_area_widget);
virtual ~WebNotificationTray();
+ virtual bool CanShowMessageCenter();
+
+ // MessageCenterTrayHost implementation part one.
+ virtual message_center::MessageCenter* message_center() OVERRIDE;
+ virtual void OnShowMessageCenterBubble() OVERRIDE;
+ virtual void OnHideMessageCenterBubble() OVERRIDE;
+
// Set whether or not the popup notifications should be hidden.
void SetHidePopupBubble(bool hide);
+ // MessageCenterTrayHost implementation part two.
+ virtual bool CanShowPopups() OVERRIDE;
+
+ // Displays the quiet mode bubble and adds |this| as an observer.
Pete Williamson 2013/01/16 19:43:20 The comment makes it sound like the function does
dewittj 2013/01/16 22:30:40 This isn't a functionality change, just updated co
+ void ShowQuietModeBubble();
+
// Updates tray visibility login status of the system changes.
void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
@@ -73,96 +74,57 @@ 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;
virtual string16 GetAccessibleNameForTray() OVERRIDE;
virtual void HideBubbleWithView(
const views::TrayBubbleView* bubble_view) OVERRIDE;
- virtual bool ClickedOutsideBubble() OVERRIDE;
// Overridden from internal::ActionableView.
virtual bool PerformAction(const ui::Event& event) OVERRIDE;
- // Overridden from views::TrayBubbleView::Delegate.
- virtual void BubbleViewDestroyed() OVERRIDE;
- virtual void OnMouseEnteredView() OVERRIDE;
- virtual void OnMouseExitedView() OVERRIDE;
+ // MessageCenterTrayHost implementation part three.
virtual string16 GetAccessibleNameForBubble() OVERRIDE;
- virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget,
- AnchorType anchor_type,
- 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;
+ virtual gfx::Rect GetAnchorRect(
+ views::Widget* anchor_widget,
+ views::TrayBubbleView::AnchorType anchor_type,
+ views::TrayBubbleView::AnchorAlignment anchor_alignment) OVERRIDE;
- // Overridden from ButtonListener.
+ // Overridden from views::ButtonListener.
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
- // Overridden from WidgetObserver.
+ // Overridden from views::WidgetObserver.
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
- private:
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest,
- ManyMessageCenterNotifications);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, ManyPopupNotifications);
+ // MessageCenterTrayHost implementation part four.
+ virtual gfx::NativeView GetBubbleWindowContainer() OVERRIDE;
+ virtual views::View* GetAnchorView() OVERRIDE;
+ virtual views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() OVERRIDE;
+ virtual void UpdateInitParams(
+ views::TrayBubbleView::InitParams* init_params) OVERRIDE;
+ virtual void OnMessageCenterTrayChanged() OVERRIDE;
- // Shows or hides the message center bubble.
- void ToggleMessageCenterBubble();
-
- // Shows or updates the message center bubble and hides the popup bubble.
- void ShowMessageCenterBubble();
-
- // 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.
- 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();
- }
+ // Overridden from TrayBackgroundView.
+ virtual bool ClickedOutsideBubble() OVERRIDE;
- internal::WebNotificationBubbleWrapper* popup_bubble() const {
- return popup_bubble_.get();
- }
+ // Tells the tray to show the MessageCenter bubble.
+ void ShowMessageCenter();
- message_center::QuietModeBubble* quiet_mode_bubble() const {
- return quiet_mode_bubble_.get();
- }
+ bool IsPopupVisible() const;
- // Testing accessors.
- message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
- message_center::MessagePopupBubble* GetPopupBubbleForTest();
+ private:
+ FRIEND_TEST_ALL_PREFIXES(::WebNotificationTrayTest,
+ ManyMessageCenterNotifications);
+ views::ImageButton* button_;
- message_center::MessageCenter* message_center_;
- scoped_ptr<internal::WebNotificationBubbleWrapper> message_center_bubble_;
- scoped_ptr<internal::WebNotificationBubbleWrapper> popup_bubble_;
scoped_ptr<message_center::QuietModeBubble> quiet_mode_bubble_;
- views::ImageButton* button_;
+ scoped_ptr<ui::MessageCenterTray> message_center_tray_;
+
bool show_message_center_on_unlock_;
+ bool message_center_visible_;
- DISALLOW_COPY_AND_ASSIGN(WebNotificationTray);
};
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698