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

Unified Diff: chrome/browser/ui/views/message_center/notification_bubble_wrapper_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/message_center/notification_bubble_wrapper_win.h
diff --git a/chrome/browser/ui/views/message_center/notification_bubble_wrapper_win.h b/chrome/browser/ui/views/message_center/notification_bubble_wrapper_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ce5737ed1f1a836225dd44f0b00cd9aab0ee592
--- /dev/null
+++ b/chrome/browser/ui/views/message_center/notification_bubble_wrapper_win.h
@@ -0,0 +1,60 @@
+// 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_NOTIFICATION_BUBBLE_WRAPPER_WIN_H_
+#define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WIN_H_
+
+#include "chrome/browser/ui/views/message_center/web_notification_tray_win.h"
+#include "ui/views/bubble/tray_bubble_view.h"
+#include "ui/views/widget/widget.h"
+
+namespace ui {
+
+namespace internal {
Pete Williamson 2013/01/23 19:52:16 instead of "internal", should we use a more specif
dewittj 2013/01/23 22:07:51 Classes in ui::internal should not be used by clas
+
+// NotificationBubbleWrapperWin is a class that manages the views associated
+// with a MessageBubbleBase object and that notifies the WebNotificationTrayWin
+// when the widget closes. Delegates GetAnchorRect to the
+// WebNotificationTrayWin.
+class NotificationBubbleWrapperWin
+ : public views::WidgetObserver,
+ public views::TrayBubbleView::Delegate {
+ public:
+ // Takes ownership of |bubble|.
+ NotificationBubbleWrapperWin(WebNotificationTrayWin* tray,
+ message_center::MessageBubbleBase* bubble,
+ AnchorType anchor_type);
+ ~NotificationBubbleWrapperWin();
+
+ // Overridden from views::WidgetObserver.
+ void OnWidgetClosing(views::Widget* widget);
+
+ // TrayBubbleView::Delegate implementation.
+ virtual void BubbleViewDestroyed();
+ virtual void OnMouseEnteredView();
+ virtual void OnMouseExitedView();
+ virtual string16 GetAccessibleNameForBubble();
+ virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget,
+ AnchorType anchor_type,
+ AnchorAlignment anchor_alignment);
+ virtual void HideBubble(const views::TrayBubbleView* bubble_view);
+
+ // Convenience accessors.
Pete Williamson 2013/01/23 19:52:16 Do we need to expose these as public? It seems a
dewittj 2013/01/23 22:07:51 This is only used for equality testing, not for di
+ views::TrayBubbleView* bubble_view() const { return bubble_view_; }
+ views::Widget* bubble_widget() const { return bubble_widget_; }
+ message_center::MessageBubbleBase* bubble() const { return bubble_.get(); }
+
+ private:
+ scoped_ptr<message_center::MessageBubbleBase> bubble_;
+ // |bubble_view_| is unowned.
Pete Williamson 2013/01/23 19:52:16 If bubble view is unowned, how do we know it is al
dewittj 2013/01/23 22:07:51 The widget owns bubble_view_.
Pete Williamson 2013/01/23 23:47:53 In that case, let's change the comment to note tha
+ views::TrayBubbleView* bubble_view_;
+ views::Widget* bubble_widget_;
+ WebNotificationTrayWin* tray_;
+};
+
+} // namespace internal
+
+} // namespace ui
+
+#endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698