Chromium Code Reviews| 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/message_center/message_center_tray_delegate.h" | |
| 11 #include "ui/views/bubble/tray_bubble_view.h" | |
| 12 | |
| 13 class StatusIcon; | |
| 14 | |
| 15 namespace message_center { | |
| 16 class MessageCenter; | |
| 17 class MessageCenterBubble; | |
| 18 class MessagePopupBubble; | |
| 19 } | |
| 20 | |
| 21 namespace views { | |
| 22 class Widget; | |
| 23 } | |
| 24 | |
| 25 namespace message_center { | |
| 26 | |
| 27 namespace internal { | |
| 28 class NotificationBubbleWrapperWin; | |
| 29 } | |
| 30 | |
| 31 // A MessageCenterTrayDelegate implementation that exposes the MessageCenterTray | |
| 32 // via a system tray icon. The notification popups will be displayed in the | |
| 33 // corner of the screen and the message center will be displayed by the system | |
| 34 // tray icon on click. | |
| 35 // TODO(dewittj): Quiet mode. | |
| 36 class WebNotificationTrayWin | |
| 37 : public message_center::MessageCenterTrayDelegate, | |
| 38 public StatusIconObserver { | |
| 39 public: | |
| 40 WebNotificationTrayWin(); | |
| 41 virtual ~WebNotificationTrayWin(); | |
| 42 | |
| 43 virtual message_center::MessageCenter* message_center(); | |
| 44 | |
| 45 // MessageCenterTrayDelegate implementation. | |
| 46 virtual bool ShowPopups() OVERRIDE; | |
| 47 virtual void HidePopups() OVERRIDE; | |
| 48 virtual bool ShowMessageCenter() 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( | |
|
miket_OOO
2013/01/25 17:14:48
It's unclear from the comments whether these shoul
dewittj
2013/01/25 19:38:46
Comments updated - they are not actually overrides
| |
| 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 message_center | |
| 92 | |
| 93 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_ | |
| OLD | NEW |