OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_ |
| 7 |
| 8 #include "chrome/browser/status_icons/status_icon_observer.h" |
| 9 #include "ui/message_center/message_center_tray.h" |
| 10 #include "ui/views/bubble/tray_bubble_view.h" |
| 11 |
| 12 class StatusIcon; |
| 13 |
| 14 namespace message_center { |
| 15 class MessageCenter; |
| 16 class MessageCenterBubble; |
| 17 class MessagePopupBubble; |
| 18 } |
| 19 |
| 20 namespace views { |
| 21 class Widget; |
| 22 } |
| 23 |
| 24 namespace ui { |
| 25 |
| 26 namespace internal { |
| 27 class NotificationBubbleWrapperWin; |
| 28 } |
| 29 |
| 30 // A MessageCenterTrayDelegate implementation that exposes the MessageCenterTray |
| 31 // via a system tray icon. The notification popups will be displayed in the |
| 32 // corner of the screen and the message center will be displayed by the system |
| 33 // tray icon on click. |
| 34 // TODO(dewittj): Quiet mode. |
| 35 class WebNotificationTrayWin |
| 36 : public MessageCenterTrayDelegate, |
| 37 public StatusIconObserver { |
| 38 public: |
| 39 WebNotificationTrayWin(); |
| 40 virtual ~WebNotificationTrayWin(); |
| 41 |
| 42 virtual message_center::MessageCenter* message_center(); |
| 43 |
| 44 // MessageCenterTrayDelegate implementation. |
| 45 virtual bool ShowPopups(message_center::MessageBubbleBase* bubble) OVERRIDE; |
| 46 virtual void HidePopups() OVERRIDE; |
| 47 virtual bool ShowMessageCenter( |
| 48 message_center::MessageBubbleBase* bubble) OVERRIDE; |
| 49 virtual void HideMessageCenter() OVERRIDE; |
| 50 virtual void UpdateMessageCenter() OVERRIDE; |
| 51 virtual void UpdatePopups() OVERRIDE; |
| 52 virtual void OnMessageCenterTrayChanged() OVERRIDE; |
| 53 |
| 54 virtual gfx::Rect GetAnchorRect( |
| 55 gfx::Size preferred_size, |
| 56 views::TrayBubbleView::AnchorType anchor_type, |
| 57 views::TrayBubbleView::AnchorAlignment anchor_alignment); |
| 58 virtual gfx::NativeView GetBubbleWindowContainer(); |
| 59 virtual views::TrayBubbleView::AnchorAlignment GetAnchorAlignment(); |
| 60 |
| 61 // StatusIconObserver override. |
| 62 virtual void OnStatusIconClicked() OVERRIDE; |
| 63 |
| 64 virtual void HideBubbleWithView( |
| 65 const views::TrayBubbleView* bubble_view); |
| 66 |
| 67 private: |
| 68 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, WebNotifications); |
| 69 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, |
| 70 WebNotificationPopupBubble); |
| 71 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, |
| 72 ManyMessageCenterNotifications); |
| 73 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, ManyPopupNotifications); |
| 74 |
| 75 void UpdateAnchorRect(); |
| 76 message_center::MessagePopupBubble* GetPopupBubbleForTest(); |
| 77 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); |
| 78 |
| 79 scoped_ptr<internal::NotificationBubbleWrapperWin> popup_bubble_; |
| 80 scoped_ptr<internal::NotificationBubbleWrapperWin> message_center_bubble_; |
| 81 |
| 82 StatusIcon* status_icon_; |
| 83 bool message_center_visible_; |
| 84 scoped_ptr<MessageCenterTray> message_center_tray_; |
| 85 gfx::Rect message_center_anchor_rect_; |
| 86 gfx::Rect popup_anchor_rect_; |
| 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayWin); |
| 89 }; |
| 90 |
| 91 } // namespace ui |
| 92 |
| 93 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_ |
OLD | NEW |