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

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: Address sky/msw comments + rebase. Created 7 years, 10 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/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 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 // 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 gfx::Rect GetAnchorRect(
58 gfx::Size preferred_size,
59 views::TrayBubbleView::AnchorType anchor_type,
60 views::TrayBubbleView::AnchorAlignment anchor_alignment);
61 gfx::NativeView GetBubbleWindowContainer();
62 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment();
63
64 // StatusIconObserver implementation.
65 virtual void OnStatusIconClicked() OVERRIDE;
66
67 void HideBubbleWithView(const views::TrayBubbleView* bubble_view);
68
69 private:
70 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, WebNotifications);
71 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
72 WebNotificationPopupBubble);
73 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
74 ManyMessageCenterNotifications);
75 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, ManyPopupNotifications);
76
77 void UpdateAnchorRect();
78 message_center::MessagePopupBubble* GetPopupBubbleForTest();
79 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
80
81 scoped_ptr<internal::NotificationBubbleWrapperWin> popup_bubble_;
82 scoped_ptr<internal::NotificationBubbleWrapperWin> message_center_bubble_;
83
84 StatusIcon* status_icon_;
85 bool message_center_visible_;
86 scoped_ptr<MessageCenterTray> message_center_tray_;
87 gfx::Rect message_center_anchor_rect_;
88 gfx::Rect popup_anchor_rect_;
89
90 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayWin);
91 };
92
93 } // namespace message_center
94
95 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698