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 template <typename T> struct DefaultSingletonTraits; | |
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 ui { | |
26 | |
27 namespace internal { | |
28 class NotificationBubbleWrapperWin; | |
29 } | |
30 | |
31 // A Message Center Tray Host class that manages a system tray icon. The | |
32 // notification popups will be displayed in the corner of the screen and the | |
33 // message center will be displayed by the system tray icon on click. | |
34 // TODO(dewittj): quiet mode. | |
35 class WebNotificationTrayWin | |
36 : public MessageCenterTrayDelegate, | |
37 public MessageCenterTrayObserver, | |
38 public StatusIconObserver { | |
39 public: | |
40 WebNotificationTrayWin(); | |
41 virtual ~WebNotificationTrayWin(); | |
42 | |
43 virtual message_center::MessageCenter* message_center(); | |
44 | |
45 // MessageCenterTrayHost implementation. | |
46 virtual bool ShowPopups(message_center::MessageBubbleBase* bubble) OVERRIDE; | |
47 virtual void HidePopups() OVERRIDE; | |
48 virtual bool ShowMessageCenter( | |
49 message_center::MessageBubbleBase* bubble) OVERRIDE; | |
50 virtual void HideMessageCenter() OVERRIDE; | |
51 virtual void UpdateMessageCenter() OVERRIDE; | |
52 virtual void UpdatePopups() OVERRIDE; | |
53 | |
54 // MessageCenterTrayObserver implementation. | |
55 virtual void OnMessageCenterTrayChanged() OVERRIDE; | |
56 | |
57 virtual gfx::Rect GetAnchorRect( | |
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 override. | |
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 MessageCenterTray* message_center_tray_; | |
Jun Mukai
2013/01/22 18:55:34
message_center_tray_ is created in constructor but
dewittj
2013/01/22 20:49:21
Yes. Done.
| |
88 gfx::Rect message_center_anchor_rect_; | |
89 gfx::Rect popup_anchor_rect_; | |
90 | |
91 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayWin); | |
92 }; | |
93 | |
94 } // namespace ui | |
95 | |
96 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_ | |
OLD | NEW |