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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 class ASH_EXPORT WebNotificationTray | 46 class ASH_EXPORT WebNotificationTray |
47 : public TrayBackgroundView, | 47 : public TrayBackgroundView, |
48 public views::TrayBubbleView::Delegate, | 48 public views::TrayBubbleView::Delegate, |
49 public message_center::MessageCenterTrayDelegate, | 49 public message_center::MessageCenterTrayDelegate, |
50 public views::ButtonListener, | 50 public views::ButtonListener, |
51 public base::SupportsWeakPtr<WebNotificationTray>, | 51 public base::SupportsWeakPtr<WebNotificationTray>, |
52 public ui::SimpleMenuModel::Delegate { | 52 public ui::SimpleMenuModel::Delegate { |
53 public: | 53 public: |
54 explicit WebNotificationTray(StatusAreaWidget* status_area_widget); | 54 explicit WebNotificationTray(StatusAreaWidget* status_area_widget); |
55 virtual ~WebNotificationTray(); | 55 ~WebNotificationTray() override; |
56 | 56 |
57 // 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 |
58 // 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 |
59 // shown in the system tray side. | 59 // shown in the system tray side. |
60 void SetSystemTrayHeight(int height); | 60 void SetSystemTrayHeight(int height); |
61 | 61 |
62 // 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. |
63 bool ShouldBlockShelfAutoHide() const; | 63 bool ShouldBlockShelfAutoHide() const; |
64 | 64 |
65 // Returns true if the message center bubble is visible. | 65 // Returns true if the message center bubble is visible. |
66 bool IsMessageCenterBubbleVisible() const; | 66 bool IsMessageCenterBubbleVisible() const; |
67 | 67 |
68 // Returns true if the mouse is inside the notification bubble. | 68 // Returns true if the mouse is inside the notification bubble. |
69 bool IsMouseInNotificationBubble() const; | 69 bool IsMouseInNotificationBubble() const; |
70 | 70 |
71 // Shows the message center bubble. | 71 // Shows the message center bubble. |
72 void ShowMessageCenterBubble(); | 72 void ShowMessageCenterBubble(); |
73 | 73 |
74 // Called when the login status is changed. | 74 // Called when the login status is changed. |
75 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 75 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
76 | 76 |
77 // Overridden from TrayBackgroundView. | 77 // Overridden from TrayBackgroundView. |
78 virtual void SetShelfAlignment(ShelfAlignment alignment) override; | 78 void SetShelfAlignment(ShelfAlignment alignment) override; |
79 virtual void AnchorUpdated() override; | 79 void AnchorUpdated() override; |
80 virtual base::string16 GetAccessibleNameForTray() override; | 80 base::string16 GetAccessibleNameForTray() override; |
81 virtual void HideBubbleWithView( | 81 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
82 const views::TrayBubbleView* bubble_view) override; | 82 bool ClickedOutsideBubble() override; |
83 virtual bool ClickedOutsideBubble() override; | |
84 | 83 |
85 // Overridden from ActionableView. | 84 // Overridden from ActionableView. |
86 virtual bool PerformAction(const ui::Event& event) override; | 85 bool PerformAction(const ui::Event& event) override; |
87 | 86 |
88 // Overridden from views::TrayBubbleView::Delegate. | 87 // Overridden from views::TrayBubbleView::Delegate. |
89 virtual void BubbleViewDestroyed() override; | 88 void BubbleViewDestroyed() override; |
90 virtual void OnMouseEnteredView() override; | 89 void OnMouseEnteredView() override; |
91 virtual void OnMouseExitedView() override; | 90 void OnMouseExitedView() override; |
92 virtual base::string16 GetAccessibleNameForBubble() override; | 91 base::string16 GetAccessibleNameForBubble() override; |
93 virtual gfx::Rect GetAnchorRect( | 92 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
94 views::Widget* anchor_widget, | 93 AnchorType anchor_type, |
95 AnchorType anchor_type, | 94 AnchorAlignment anchor_alignment) const override; |
96 AnchorAlignment anchor_alignment) const override; | 95 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
97 virtual void HideBubble(const views::TrayBubbleView* bubble_view) override; | |
98 | 96 |
99 // Overridden from ButtonListener. | 97 // Overridden from ButtonListener. |
100 virtual void ButtonPressed(views::Button* sender, | 98 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
101 const ui::Event& event) override; | |
102 | 99 |
103 // Overridden from MessageCenterTrayDelegate. | 100 // Overridden from MessageCenterTrayDelegate. |
104 virtual void OnMessageCenterTrayChanged() override; | 101 void OnMessageCenterTrayChanged() override; |
105 virtual bool ShowMessageCenter() override; | 102 bool ShowMessageCenter() override; |
106 virtual void HideMessageCenter() override; | 103 void HideMessageCenter() override; |
107 virtual bool ShowPopups() override; | 104 bool ShowPopups() override; |
108 virtual void HidePopups() override; | 105 void HidePopups() override; |
109 virtual bool ShowNotifierSettings() override; | 106 bool ShowNotifierSettings() override; |
110 virtual bool IsContextMenuEnabled() const override; | 107 bool IsContextMenuEnabled() const override; |
111 virtual message_center::MessageCenterTray* GetMessageCenterTray() override; | 108 message_center::MessageCenterTray* GetMessageCenterTray() override; |
112 | 109 |
113 // Overridden from SimpleMenuModel::Delegate. | 110 // Overridden from SimpleMenuModel::Delegate. |
114 virtual bool IsCommandIdChecked(int command_id) const override; | 111 bool IsCommandIdChecked(int command_id) const override; |
115 virtual bool IsCommandIdEnabled(int command_id) const override; | 112 bool IsCommandIdEnabled(int command_id) const override; |
116 virtual bool GetAcceleratorForCommandId( | 113 bool GetAcceleratorForCommandId(int command_id, |
117 int command_id, | 114 ui::Accelerator* accelerator) override; |
118 ui::Accelerator* accelerator) override; | 115 void ExecuteCommand(int command_id, int event_flags) override; |
119 virtual void ExecuteCommand(int command_id, int event_flags) override; | |
120 | 116 |
121 message_center::MessageCenter* message_center() const; | 117 message_center::MessageCenter* message_center() const; |
122 | 118 |
123 private: | 119 private: |
124 friend class WebNotificationTrayTest; | 120 friend class WebNotificationTrayTest; |
125 | 121 |
126 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications); | 122 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications); |
127 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble); | 123 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble); |
128 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, | 124 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, |
129 ManyMessageCenterNotifications); | 125 ManyMessageCenterNotifications); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool should_block_shelf_auto_hide_; | 172 bool should_block_shelf_auto_hide_; |
177 | 173 |
178 scoped_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; | 174 scoped_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; |
179 | 175 |
180 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); | 176 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); |
181 }; | 177 }; |
182 | 178 |
183 } // namespace ash | 179 } // namespace ash |
184 | 180 |
185 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 181 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
OLD | NEW |