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/user/login_status.h" | 10 #include "ash/system/user/login_status.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 namespace message_center { | 33 namespace message_center { |
34 class MessageBubbleBase; | 34 class MessageBubbleBase; |
35 class MessageCenter; | 35 class MessageCenter; |
36 class MessageCenterBubble; | 36 class MessageCenterBubble; |
37 class MessagePopupCollection; | 37 class MessagePopupCollection; |
38 } | 38 } |
39 | 39 |
40 namespace ash { | 40 namespace ash { |
41 namespace internal { | |
42 class StatusAreaWidget; | 41 class StatusAreaWidget; |
43 class WebNotificationBubbleWrapper; | 42 class WebNotificationBubbleWrapper; |
44 class WebNotificationButton; | 43 class WebNotificationButton; |
45 class WorkAreaObserver; | 44 class WorkAreaObserver; |
46 } | |
47 | 45 |
48 class ASH_EXPORT WebNotificationTray | 46 class ASH_EXPORT WebNotificationTray |
49 : public internal::TrayBackgroundView, | 47 : public TrayBackgroundView, |
50 public views::TrayBubbleView::Delegate, | 48 public views::TrayBubbleView::Delegate, |
51 public message_center::MessageCenterTrayDelegate, | 49 public message_center::MessageCenterTrayDelegate, |
52 public views::ButtonListener, | 50 public views::ButtonListener, |
53 public base::SupportsWeakPtr<WebNotificationTray>, | 51 public base::SupportsWeakPtr<WebNotificationTray>, |
54 public ui::SimpleMenuModel::Delegate { | 52 public ui::SimpleMenuModel::Delegate { |
55 public: | 53 public: |
56 explicit WebNotificationTray( | 54 explicit WebNotificationTray(StatusAreaWidget* status_area_widget); |
57 internal::StatusAreaWidget* status_area_widget); | |
58 virtual ~WebNotificationTray(); | 55 virtual ~WebNotificationTray(); |
59 | 56 |
60 // Sets the height of the system tray from the edge of the work area so that | 57 // Sets the height of the system tray from the edge of the work area so that |
61 // the notification popups don't overlap with the tray. Passes 0 if no UI is | 58 // the notification popups don't overlap with the tray. Passes 0 if no UI is |
62 // shown in the system tray side. | 59 // shown in the system tray side. |
63 void SetSystemTrayHeight(int height); | 60 void SetSystemTrayHeight(int height); |
64 | 61 |
65 // Returns true if it should block the auto hide behavior of the shelf. | 62 // Returns true if it should block the auto hide behavior of the shelf. |
66 bool ShouldBlockShelfAutoHide() const; | 63 bool ShouldBlockShelfAutoHide() const; |
67 | 64 |
(...skipping 10 matching lines...) Expand all Loading... |
78 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 75 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
79 | 76 |
80 // Overridden from TrayBackgroundView. | 77 // Overridden from TrayBackgroundView. |
81 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; | 78 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
82 virtual void AnchorUpdated() OVERRIDE; | 79 virtual void AnchorUpdated() OVERRIDE; |
83 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; | 80 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; |
84 virtual void HideBubbleWithView( | 81 virtual void HideBubbleWithView( |
85 const views::TrayBubbleView* bubble_view) OVERRIDE; | 82 const views::TrayBubbleView* bubble_view) OVERRIDE; |
86 virtual bool ClickedOutsideBubble() OVERRIDE; | 83 virtual bool ClickedOutsideBubble() OVERRIDE; |
87 | 84 |
88 // Overridden from internal::ActionableView. | 85 // Overridden from ActionableView. |
89 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 86 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
90 | 87 |
91 // Overridden from views::TrayBubbleView::Delegate. | 88 // Overridden from views::TrayBubbleView::Delegate. |
92 virtual void BubbleViewDestroyed() OVERRIDE; | 89 virtual void BubbleViewDestroyed() OVERRIDE; |
93 virtual void OnMouseEnteredView() OVERRIDE; | 90 virtual void OnMouseEnteredView() OVERRIDE; |
94 virtual void OnMouseExitedView() OVERRIDE; | 91 virtual void OnMouseExitedView() OVERRIDE; |
95 virtual base::string16 GetAccessibleNameForBubble() OVERRIDE; | 92 virtual base::string16 GetAccessibleNameForBubble() OVERRIDE; |
96 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, | 93 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
97 AnchorType anchor_type, | 94 AnchorType anchor_type, |
98 AnchorAlignment anchor_alignment) OVERRIDE; | 95 AnchorAlignment anchor_alignment) OVERRIDE; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 144 |
148 // Returns true if it should show the quiet mode menu. | 145 // Returns true if it should show the quiet mode menu. |
149 bool ShouldShowQuietModeMenu(const ui::Event& event); | 146 bool ShouldShowQuietModeMenu(const ui::Event& event); |
150 | 147 |
151 // Shows the quiet mode menu. | 148 // Shows the quiet mode menu. |
152 void ShowQuietModeMenu(const ui::Event& event); | 149 void ShowQuietModeMenu(const ui::Event& event); |
153 | 150 |
154 // Creates the menu model for quiet mode and returns it. | 151 // Creates the menu model for quiet mode and returns it. |
155 ui::MenuModel* CreateQuietModeMenu(); | 152 ui::MenuModel* CreateQuietModeMenu(); |
156 | 153 |
157 internal::WebNotificationBubbleWrapper* message_center_bubble() const { | 154 WebNotificationBubbleWrapper* message_center_bubble() const { |
158 return message_center_bubble_.get(); | 155 return message_center_bubble_.get(); |
159 } | 156 } |
160 | 157 |
161 // Testing accessors. | 158 // Testing accessors. |
162 bool IsPopupVisible() const; | 159 bool IsPopupVisible() const; |
163 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); | 160 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); |
164 | 161 |
165 scoped_ptr<message_center::MessageCenterTray> message_center_tray_; | 162 scoped_ptr<message_center::MessageCenterTray> message_center_tray_; |
166 scoped_ptr<internal::WebNotificationBubbleWrapper> message_center_bubble_; | 163 scoped_ptr<WebNotificationBubbleWrapper> message_center_bubble_; |
167 scoped_ptr<message_center::MessagePopupCollection> popup_collection_; | 164 scoped_ptr<message_center::MessagePopupCollection> popup_collection_; |
168 internal::WebNotificationButton* button_; | 165 WebNotificationButton* button_; |
169 | 166 |
170 bool show_message_center_on_unlock_; | 167 bool show_message_center_on_unlock_; |
171 | 168 |
172 bool should_update_tray_content_; | 169 bool should_update_tray_content_; |
173 | 170 |
174 // True when the shelf auto hide behavior has to be blocked. Previously | 171 // True when the shelf auto hide behavior has to be blocked. Previously |
175 // this was done by checking |message_center_bubble_| but actually | 172 // this was done by checking |message_center_bubble_| but actually |
176 // the check can be called when creating this object, so it would cause | 173 // the check can be called when creating this object, so it would cause |
177 // flickers of the shelf from hidden to shown. See: crbug.com/181213 | 174 // flickers of the shelf from hidden to shown. See: crbug.com/181213 |
178 bool should_block_shelf_auto_hide_; | 175 bool should_block_shelf_auto_hide_; |
179 | 176 |
180 // Observes the work area for |popup_collection_| and notifies to it. | 177 // Observes the work area for |popup_collection_| and notifies to it. |
181 scoped_ptr<internal::WorkAreaObserver> work_area_observer_; | 178 scoped_ptr<WorkAreaObserver> work_area_observer_; |
182 | 179 |
183 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); | 180 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); |
184 }; | 181 }; |
185 | 182 |
186 } // namespace ash | 183 } // namespace ash |
187 | 184 |
188 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 185 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
OLD | NEW |