Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1429)

Side by Side Diff: chrome/browser/ui/views/message_center/web_notification_tray_win.h

Issue 11819048: Implement message center on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Now with more tests, and corrected copyright notices. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 static WebNotificationTrayWin* GetInstance();
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 bool CanShowPopups();
62 virtual gfx::NativeView GetBubbleWindowContainer();
63 virtual views::TrayBubbleView::AnchorAlignment GetAnchorAlignment();
64
65 // StatusIconObserver override.
66 virtual void OnStatusIconClicked() OVERRIDE;
67
68 virtual void HideBubbleWithView(
69 const views::TrayBubbleView* bubble_view);
70
71 private:
72 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, WebNotifications);
73 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
74 WebNotificationPopupBubble);
75 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
76 ManyMessageCenterNotifications);
77 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, ManyPopupNotifications);
78
79 WebNotificationTrayWin();
80 void UpdateAnchorRect();
81 message_center::MessagePopupBubble* GetPopupBubbleForTest();
82 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
83
84 scoped_ptr<internal::NotificationBubbleWrapperWin> popup_bubble_;
85 scoped_ptr<internal::NotificationBubbleWrapperWin> message_center_bubble_;
86
87 StatusIcon* status_icon_;
88 bool message_center_visible_;
89 MessageCenterTray* message_center_tray_;
90 gfx::Rect message_center_anchor_rect_;
91 gfx::Rect popup_anchor_rect_;
92
93 friend struct DefaultSingletonTraits<WebNotificationTrayWin>;
94 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayWin);
95 };
96
97 } // namespace ui
98
99 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698