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(); | |
|
sky
2013/01/30 14:38:17
unix_hacker_style methods shouldn't be virtual.
dewittj
2013/01/30 23:08:32
Done.
| |
| 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 // These are forwarded to WebNotificationTrayWin by | |
| 55 // NotificationBubbleWrapperWin classes since they don't have enough | |
| 56 // context to provide the required data for TrayBubbleView::Delegate. | |
| 57 virtual gfx::Rect GetAnchorRect( | |
|
msw
2013/01/29 23:23:16
Why are these three functions virtual?
They don't
dewittj
2013/01/30 23:08:32
Relic. Removed.
| |
| 58 gfx::Size preferred_size, | |
| 59 views::TrayBubbleView::AnchorType anchor_type, | |
| 60 views::TrayBubbleView::AnchorAlignment anchor_alignment); | |
| 61 virtual gfx::NativeView GetBubbleWindowContainer(); | |
| 62 virtual views::TrayBubbleView::AnchorAlignment GetAnchorAlignment(); | |
| 63 | |
| 64 // StatusIconObserver implementation. | |
| 65 virtual void OnStatusIconClicked() OVERRIDE; | |
| 66 | |
| 67 virtual void HideBubbleWithView( | |
| 68 const views::TrayBubbleView* bubble_view); | |
| 69 | |
| 70 private: | |
| 71 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, WebNotifications); | |
| 72 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, | |
| 73 WebNotificationPopupBubble); | |
| 74 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, | |
| 75 ManyMessageCenterNotifications); | |
| 76 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, ManyPopupNotifications); | |
| 77 | |
| 78 void UpdateAnchorRect(); | |
| 79 message_center::MessagePopupBubble* GetPopupBubbleForTest(); | |
| 80 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); | |
| 81 | |
| 82 scoped_ptr<internal::NotificationBubbleWrapperWin> popup_bubble_; | |
| 83 scoped_ptr<internal::NotificationBubbleWrapperWin> message_center_bubble_; | |
| 84 | |
| 85 StatusIcon* status_icon_; | |
| 86 bool message_center_visible_; | |
| 87 scoped_ptr<MessageCenterTray> message_center_tray_; | |
| 88 gfx::Rect message_center_anchor_rect_; | |
| 89 gfx::Rect popup_anchor_rect_; | |
| 90 | |
| 91 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayWin); | |
| 92 }; | |
| 93 | |
| 94 } // namespace message_center | |
| 95 | |
| 96 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_ | |
| OLD | NEW |