Chromium Code Reviews| 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..8f72994a413f683af85054acc3204373e85487ac 100644 |
| --- a/ash/system/web_notification/web_notification_tray.h |
| +++ b/ash/system/web_notification/web_notification_tray.h |
| @@ -7,10 +7,11 @@ |
| #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/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 +22,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 +39,12 @@ class WebNotificationBubbleWrapper; |
| class ASH_EXPORT WebNotificationTray |
| : public internal::TrayBackgroundView, |
| public views::TrayBubbleView::Delegate, |
| - public message_center::MessageCenter::Observer, |
| + public ui::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,9 +62,7 @@ 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_; |
| - } |
| + virtual message_center::MessageCenter* message_center(); |
| // Overridden from TrayBackgroundView. |
| virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
| @@ -88,6 +75,9 @@ class ASH_EXPORT WebNotificationTray |
| // Overridden from internal::ActionableView. |
| virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
| + // Tells the tray to show the MessageCenter bubble. |
| + void ShowMessageCenter(); |
| + |
| // Overridden from views::TrayBubbleView::Delegate. |
| virtual void BubbleViewDestroyed() OVERRIDE; |
| virtual void OnMouseEnteredView() OVERRIDE; |
| @@ -98,8 +88,8 @@ 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 MessageCenterTrayDelegate. |
| + virtual void OnMessageCenterTrayChanged() OVERRIDE; |
| // Overridden from ButtonListener. |
| virtual void ButtonPressed(views::Button* sender, |
| @@ -115,29 +105,29 @@ 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(); |
| - |
| - // Hides the message center bubble if visible. |
| - void HideMessageCenterBubble(); |
| - |
| - // Shows or updates the popup notification bubble if appropriate. |
| - void ShowPopupBubble(); |
| + public: |
| + // TODO(dewittj): move these up above the private area after merging trunk. |
|
Jun Mukai
2013/01/23 19:40:13
Why is this a TODO? You can just move FRIEND_TEST
dewittj
2013/01/23 22:07:52
Done.
|
| + // MessageCenterTrayDelegate implementation. |
|
Jun Mukai
2013/01/23 19:40:13
"Overridden from MessageCenterTrayDelegate."
proba
dewittj
2013/01/23 22:07:52
Done.
|
| + virtual bool ShowMessageCenter( |
| + message_center::MessageBubbleBase* bubble) OVERRIDE; |
| + virtual void UpdateMessageCenter() OVERRIDE; |
| + virtual void HideMessageCenter() OVERRIDE; |
| + virtual bool ShowPopups ( |
| + message_center::MessageBubbleBase* bubble) OVERRIDE; |
| + virtual void UpdatePopups() OVERRIDE; |
| + virtual void HidePopups() OVERRIDE; |
| - // Hides the notification bubble if visible. |
| - void HidePopupBubble(); |
| + private: |
| + // Queries login status and the status area widget to determine visibility of |
| + // the message center. |
| + bool ShouldShowMessageCenter(); |
| - // 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 +142,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<ui::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); |