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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/message_center/web_notification_tray_win.h
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray_win.h b/chrome/browser/ui/views/message_center/web_notification_tray_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..67ac6d27732728b394299a5fb496d925a94dc972
--- /dev/null
+++ b/chrome/browser/ui/views/message_center/web_notification_tray_win.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_
+
+#include "chrome/browser/status_icons/status_icon_observer.h"
+#include "ui/message_center/message_center_tray.h"
+#include "ui/message_center/message_center_tray_delegate.h"
+#include "ui/views/bubble/tray_bubble_view.h"
+
+class StatusIcon;
+
+namespace message_center {
+class MessageCenter;
+class MessageCenterBubble;
+class MessagePopupBubble;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace message_center {
+
+namespace internal {
+class NotificationBubbleWrapperWin;
+}
+
+// A MessageCenterTrayDelegate implementation that exposes the MessageCenterTray
+// via a system tray icon. The notification popups will be displayed in the
+// corner of the screen and the message center will be displayed by the system
+// tray icon on click.
+// TODO(dewittj): Quiet mode.
+class WebNotificationTrayWin
+ : public message_center::MessageCenterTrayDelegate,
+ public StatusIconObserver {
+ public:
+ WebNotificationTrayWin();
+ virtual ~WebNotificationTrayWin();
+
+ message_center::MessageCenter* message_center();
+
+ // MessageCenterTrayDelegate implementation.
+ virtual bool ShowPopups() OVERRIDE;
+ virtual void HidePopups() OVERRIDE;
+ virtual bool ShowMessageCenter() OVERRIDE;
+ virtual void HideMessageCenter() OVERRIDE;
+ virtual void UpdateMessageCenter() OVERRIDE;
+ virtual void UpdatePopups() OVERRIDE;
+ virtual void OnMessageCenterTrayChanged() OVERRIDE;
+
+ // These are forwarded to WebNotificationTrayWin by
+ // NotificationBubbleWrapperWin classes since they don't have enough
+ // context to provide the required data for TrayBubbleView::Delegate.
+ gfx::Rect GetAnchorRect(
+ gfx::Size preferred_size,
+ views::TrayBubbleView::AnchorType anchor_type,
+ views::TrayBubbleView::AnchorAlignment anchor_alignment);
+ gfx::NativeView GetBubbleWindowContainer();
+ views::TrayBubbleView::AnchorAlignment GetAnchorAlignment();
+
+ // StatusIconObserver implementation.
+ virtual void OnStatusIconClicked() OVERRIDE;
+
+ void HideBubbleWithView(const views::TrayBubbleView* bubble_view);
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, WebNotifications);
+ FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
+ WebNotificationPopupBubble);
+ FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest,
+ ManyMessageCenterNotifications);
+ FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayWinTest, ManyPopupNotifications);
+
+ void UpdateAnchorRect();
+ message_center::MessagePopupBubble* GetPopupBubbleForTest();
+ message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
+
+ scoped_ptr<internal::NotificationBubbleWrapperWin> popup_bubble_;
+ scoped_ptr<internal::NotificationBubbleWrapperWin> message_center_bubble_;
+
+ StatusIcon* status_icon_;
+ bool message_center_visible_;
+ scoped_ptr<MessageCenterTray> message_center_tray_;
+ gfx::Rect message_center_anchor_rect_;
+ gfx::Rect popup_anchor_rect_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayWin);
+};
+
+} // namespace message_center
+
+#endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698