OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/system/tray/tray_background_view.h" | 9 #include "ash/system/tray/tray_background_view.h" |
10 #include "ash/system/tray/tray_views.h" | 10 #include "ash/system/tray/tray_views.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 namespace ash { | 44 namespace ash { |
45 | 45 |
46 namespace internal { | 46 namespace internal { |
47 class StatusAreaWidget; | 47 class StatusAreaWidget; |
48 class WebNotificationBubbleWrapper; | 48 class WebNotificationBubbleWrapper; |
49 } | 49 } |
50 | 50 |
51 class ASH_EXPORT WebNotificationTray | 51 class ASH_EXPORT WebNotificationTray |
52 : public internal::TrayBackgroundView, | 52 : public internal::TrayBackgroundView, |
53 public views::TrayBubbleView::Delegate, | 53 public views::TrayBubbleView::Delegate, |
54 public message_center::MessageCenter::Host, | 54 public message_center::MessageCenter::Observer, |
55 public views::ButtonListener, | 55 public views::ButtonListener, |
56 public views::WidgetObserver { | 56 public views::WidgetObserver { |
57 public: | 57 public: |
58 explicit WebNotificationTray(internal::StatusAreaWidget* status_area_widget); | 58 explicit WebNotificationTray(internal::StatusAreaWidget* status_area_widget); |
59 virtual ~WebNotificationTray(); | 59 virtual ~WebNotificationTray(); |
60 | 60 |
61 // Set whether or not the popup notifications should be hidden. | 61 // Set whether or not the popup notifications should be hidden. |
62 void SetHidePopupBubble(bool hide); | 62 void SetHidePopupBubble(bool hide); |
63 | 63 |
64 // Updates tray visibility login status of the system changes. | 64 // Updates tray visibility login status of the system changes. |
65 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 65 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
66 | 66 |
67 // Returns true if the message center bubble is visible. | 67 // Returns true if the message center bubble is visible. |
68 bool IsMessageCenterBubbleVisible() const; | 68 bool IsMessageCenterBubbleVisible() const; |
69 | 69 |
70 // Returns true if the mouse is inside the notification bubble. | 70 // Returns true if the mouse is inside the notification bubble. |
71 bool IsMouseInNotificationBubble() const; | 71 bool IsMouseInNotificationBubble() const; |
72 | 72 |
73 message_center::MessageCenter* message_center() { | 73 message_center::MessageCenter* message_center() { |
74 return message_center_.get(); | 74 return message_center_; |
75 } | 75 } |
76 | 76 |
77 // Overridden from TrayBackgroundView. | 77 // Overridden from TrayBackgroundView. |
78 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; | 78 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
79 virtual void AnchorUpdated() OVERRIDE; | 79 virtual void AnchorUpdated() OVERRIDE; |
80 virtual string16 GetAccessibleNameForTray() OVERRIDE; | 80 virtual string16 GetAccessibleNameForTray() OVERRIDE; |
81 virtual void HideBubbleWithView( | 81 virtual void HideBubbleWithView( |
82 const views::TrayBubbleView* bubble_view) OVERRIDE; | 82 const views::TrayBubbleView* bubble_view) OVERRIDE; |
83 virtual bool ClickedOutsideBubble() OVERRIDE; | 83 virtual bool ClickedOutsideBubble() OVERRIDE; |
84 | 84 |
85 // Overridden from internal::ActionableView. | 85 // Overridden from internal::ActionableView. |
86 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 86 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
87 | 87 |
88 // Overridden from views::TrayBubbleView::Delegate. | 88 // Overridden from views::TrayBubbleView::Delegate. |
89 virtual void BubbleViewDestroyed() OVERRIDE; | 89 virtual void BubbleViewDestroyed() OVERRIDE; |
90 virtual void OnMouseEnteredView() OVERRIDE; | 90 virtual void OnMouseEnteredView() OVERRIDE; |
91 virtual void OnMouseExitedView() OVERRIDE; | 91 virtual void OnMouseExitedView() OVERRIDE; |
92 virtual string16 GetAccessibleNameForBubble() OVERRIDE; | 92 virtual string16 GetAccessibleNameForBubble() OVERRIDE; |
93 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, | 93 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
94 AnchorType anchor_type, | 94 AnchorType anchor_type, |
95 AnchorAlignment anchor_alignment) OVERRIDE; | 95 AnchorAlignment anchor_alignment) OVERRIDE; |
96 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE; | 96 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE; |
97 | 97 |
98 // Overridden from message_center::MessageCenter::Host. | 98 // Overridden from message_center::MessageCenter::Observer. |
99 virtual void MessageCenterChanged(bool new_notification) OVERRIDE; | 99 virtual void OnMessageCenterChanged(bool new_notification) OVERRIDE; |
100 | 100 |
101 // Overridden from ButtonListener. | 101 // Overridden from ButtonListener. |
102 virtual void ButtonPressed(views::Button* sender, | 102 virtual void ButtonPressed(views::Button* sender, |
103 const ui::Event& event) OVERRIDE; | 103 const ui::Event& event) OVERRIDE; |
104 | 104 |
105 // Overridden from WidgetObserver. | 105 // Overridden from WidgetObserver. |
106 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 106 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
107 | 107 |
108 private: | 108 private: |
109 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications); | 109 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 | 146 |
147 message_center::QuietModeBubble* quiet_mode_bubble() const { | 147 message_center::QuietModeBubble* quiet_mode_bubble() const { |
148 return quiet_mode_bubble_.get(); | 148 return quiet_mode_bubble_.get(); |
149 } | 149 } |
150 | 150 |
151 // Testing accessors. | 151 // Testing accessors. |
152 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); | 152 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); |
153 message_center::MessagePopupBubble* GetPopupBubbleForTest(); | 153 message_center::MessagePopupBubble* GetPopupBubbleForTest(); |
154 | 154 |
155 scoped_ptr<message_center::MessageCenter> message_center_; | 155 message_center::MessageCenter* message_center_; |
156 scoped_ptr<internal::WebNotificationBubbleWrapper> message_center_bubble_; | 156 scoped_ptr<internal::WebNotificationBubbleWrapper> message_center_bubble_; |
157 scoped_ptr<internal::WebNotificationBubbleWrapper> popup_bubble_; | 157 scoped_ptr<internal::WebNotificationBubbleWrapper> popup_bubble_; |
158 scoped_ptr<message_center::QuietModeBubble> quiet_mode_bubble_; | 158 scoped_ptr<message_center::QuietModeBubble> quiet_mode_bubble_; |
159 views::ImageButton* button_; | 159 views::ImageButton* button_; |
160 bool show_message_center_on_unlock_; | 160 bool show_message_center_on_unlock_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); | 162 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); |
163 }; | 163 }; |
164 | 164 |
165 } // namespace ash | 165 } // namespace ash |
166 | 166 |
167 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 167 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
OLD | NEW |