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

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

Issue 18003003: Message center re-organized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Border caching added Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_
6 #define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_ 6 #define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/status_icons/status_icon_observer.h" 9 #include "chrome/browser/status_icons/status_icon_observer.h"
10 #include "chrome/browser/ui/views/message_center/message_center_widget_delegate. h"
10 #include "ui/base/models/simple_menu_model.h" 11 #include "ui/base/models/simple_menu_model.h"
12 #include "ui/gfx/rect.h"
11 #include "ui/message_center/message_center_tray.h" 13 #include "ui/message_center/message_center_tray.h"
12 #include "ui/message_center/message_center_tray_delegate.h" 14 #include "ui/message_center/message_center_tray_delegate.h"
13 #include "ui/views/bubble/tray_bubble_view.h" 15 #include "ui/views/widget/widget_observer.h"
14 16
15 class StatusIcon; 17 class StatusIcon;
16 18
17 namespace message_center { 19 namespace message_center {
18 class MessageCenter; 20 class MessageCenter;
19 class MessageCenterBubble; 21 class MessageCenterBubble;
20 class MessagePopupCollection; 22 class MessagePopupCollection;
21 } 23 }
22 24
23 namespace views { 25 namespace views {
24 class Widget; 26 class Widget;
25 } 27 }
26 28
27 namespace message_center { 29 namespace message_center {
28 30
29 namespace internal { 31 struct PositionInfo;
30 class NotificationBubbleWrapper; 32
31 } 33 class MessageCenterWidgetDelegate;
32 34
33 // A MessageCenterTrayDelegate implementation that exposes the MessageCenterTray 35 // A MessageCenterTrayDelegate implementation that exposes the MessageCenterTray
34 // via a system tray icon. The notification popups will be displayed in the 36 // via a system tray icon. The notification popups will be displayed in the
35 // corner of the screen and the message center will be displayed by the system 37 // corner of the screen and the message center will be displayed by the system
36 // tray icon on click. 38 // tray icon on click.
37 class WebNotificationTray : public message_center::MessageCenterTrayDelegate, 39 class WebNotificationTray : public message_center::MessageCenterTrayDelegate,
38 public StatusIconObserver, 40 public StatusIconObserver,
39 public base::SupportsWeakPtr<WebNotificationTray> { 41 public base::SupportsWeakPtr<WebNotificationTray> {
40 public: 42 public:
41 WebNotificationTray(); 43 WebNotificationTray();
42 virtual ~WebNotificationTray(); 44 virtual ~WebNotificationTray();
43 45
44 message_center::MessageCenter* message_center(); 46 message_center::MessageCenter* message_center();
45 47
46 // MessageCenterTrayDelegate implementation. 48 // MessageCenterTrayDelegate implementation.
47 virtual bool ShowPopups() OVERRIDE; 49 virtual bool ShowPopups() OVERRIDE;
48 virtual void HidePopups() OVERRIDE; 50 virtual void HidePopups() OVERRIDE;
49 virtual bool ShowMessageCenter() OVERRIDE; 51 virtual bool ShowMessageCenter() OVERRIDE;
50 virtual void HideMessageCenter() OVERRIDE; 52 virtual void HideMessageCenter() OVERRIDE;
51 virtual void OnMessageCenterTrayChanged() OVERRIDE; 53 virtual void OnMessageCenterTrayChanged() OVERRIDE;
52 virtual bool ShowNotifierSettings() OVERRIDE; 54 virtual bool ShowNotifierSettings() OVERRIDE;
53 55
54 // These are forwarded to WebNotificationTray by
55 // NotificationBubbleWrapper classes since they don't have enough
56 // context to provide the required data for TrayBubbleView::Delegate.
57 gfx::Rect GetMessageCenterAnchor();
58 gfx::Rect GetPopupAnchor();
59 gfx::NativeView GetBubbleWindowContainer();
60 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment();
61
62 // StatusIconObserver implementation. 56 // StatusIconObserver implementation.
63 virtual void OnStatusIconClicked() OVERRIDE; 57 virtual void OnStatusIconClicked() OVERRIDE;
64 #if defined(OS_WIN) 58 #if defined(OS_WIN)
65 virtual void OnBalloonClicked() OVERRIDE; 59 virtual void OnBalloonClicked() OVERRIDE;
66 60
67 // This shows a platform-specific balloon informing the user of the existence 61 // This shows a platform-specific balloon informing the user of the existence
68 // of the message center in the status tray area. 62 // of the message center in the status tray area.
69 void DisplayFirstRunBalloon(); 63 void DisplayFirstRunBalloon();
70 #endif 64 #endif
71 65
72 // Changes the icon and hovertext based on number of unread notifications. 66 // Changes the icon and hovertext based on number of unread notifications.
73 void UpdateStatusIcon(); 67 void UpdateStatusIcon();
74 void HideBubbleWithView(const views::TrayBubbleView* bubble_view); 68 void HideBubble();
dewittj 2013/07/15 18:38:58 Rename so that we don't refer to Bubble.
sidharthms 2013/07/15 23:16:37 Done.
69 void SetMessageCenterHidden();
70
71 // Gets the point where the status icon was clicked.
72 gfx::Point mouse_click_point() { return mouse_click_point_; }
75 73
76 private: 74 private:
77 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications); 75 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications);
78 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble); 76 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble);
79 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, 77 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest,
80 ManyMessageCenterNotifications); 78 ManyMessageCenterNotifications);
81 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, ManyPopupNotifications); 79 FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, ManyPopupNotifications);
82 80
83 // The actual process to show the message center. Set |show_settings| to true 81 // The actual process to show the message center. Set |show_settings| to true
84 // if the message center should be initialized with the settings visible. 82 // if the message center should be initialized with the settings visible.
85 // Returns true if the center is successfully created. 83 // Returns true if the center is successfully created.
86 bool ShowMessageCenterInternal(bool show_settings); 84 bool ShowMessageCenterInternal(bool show_settings);
85
86 PositionInfo GetPositionInfo();
87
87 StatusIcon* GetStatusIcon(); 88 StatusIcon* GetStatusIcon();
88 void DestroyStatusIcon(); 89 void DestroyStatusIcon();
89 void AddQuietModeMenu(StatusIcon* status_icon); 90 void AddQuietModeMenu(StatusIcon* status_icon);
90 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); 91 MessageCenterWidgetDelegate* GetMessageCenterWidgetDelegateForTest();
91 92
92 scoped_ptr<internal::NotificationBubbleWrapper> message_center_bubble_; 93 MessageCenterWidgetDelegate* message_center_delegate_;
93 scoped_ptr<message_center::MessagePopupCollection> popup_collection_; 94 scoped_ptr<message_center::MessagePopupCollection> popup_collection_;
94 95
95 StatusIcon* status_icon_; 96 StatusIcon* status_icon_;
96 bool message_center_visible_; 97 bool message_center_visible_;
97 scoped_ptr<MessageCenterTray> message_center_tray_; 98 scoped_ptr<MessageCenterTray> message_center_tray_;
98 gfx::Point mouse_click_point_; 99 gfx::Point mouse_click_point_;
99 100
100 bool should_update_tray_content_; 101 bool should_update_tray_content_;
101 102
102 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); 103 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray);
103 }; 104 };
104 105
105 } // namespace message_center 106 } // namespace message_center
106 107
107 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_ 108 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698