OLD | NEW |
(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_NOTIFICATION_BUBBLE_WRAPPER_WIN_H
_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WIN_H
_ |
| 7 |
| 8 #include "chrome/browser/ui/views/message_center/web_notification_tray_win.h" |
| 9 #include "ui/views/bubble/tray_bubble_view.h" |
| 10 #include "ui/views/widget/widget.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 namespace internal { |
| 15 |
| 16 // NotificationBubbleWrapperWin is a class that manages the views associated |
| 17 // with a MessageBubbleBase object and that notifies the WebNotificationTrayWin |
| 18 // when the widget closes. Delegates GetAnchorRect to the |
| 19 // WebNotificationTrayWin. |
| 20 class NotificationBubbleWrapperWin |
| 21 : public views::WidgetObserver, |
| 22 public views::TrayBubbleView::Delegate { |
| 23 public: |
| 24 // Takes ownership of |bubble|. |
| 25 NotificationBubbleWrapperWin(WebNotificationTrayWin* tray, |
| 26 message_center::MessageBubbleBase* bubble, |
| 27 AnchorType anchor_type); |
| 28 ~NotificationBubbleWrapperWin(); |
| 29 |
| 30 // Overridden from views::WidgetObserver. |
| 31 void OnWidgetClosing(views::Widget* widget); |
| 32 |
| 33 // TrayBubbleView::Delegate implementation. |
| 34 virtual void BubbleViewDestroyed(); |
| 35 virtual void OnMouseEnteredView(); |
| 36 virtual void OnMouseExitedView(); |
| 37 virtual string16 GetAccessibleNameForBubble(); |
| 38 // GetAnchorRect passes responsibility for BubbleDelegateView::GetAnchorRect |
| 39 // to the delegate. |
| 40 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
| 41 AnchorType anchor_type, |
| 42 AnchorAlignment anchor_alignment); |
| 43 virtual void HideBubble(const views::TrayBubbleView* bubble_view); |
| 44 |
| 45 // Convenience accessors. |
| 46 views::TrayBubbleView* bubble_view() const { return bubble_view_; } |
| 47 views::Widget* bubble_widget() const { return bubble_widget_; } |
| 48 message_center::MessageBubbleBase* bubble() const { return bubble_.get(); } |
| 49 |
| 50 private: |
| 51 scoped_ptr<message_center::MessageBubbleBase> bubble_; |
| 52 // |bubble_view_| is unowned. |
| 53 views::TrayBubbleView* bubble_view_; |
| 54 views::Widget* bubble_widget_; |
| 55 WebNotificationTrayWin* tray_; |
| 56 }; |
| 57 |
| 58 } // namespace internal |
| 59 |
| 60 } // namespace ui |
| 61 |
| 62 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WI
N_H_ |
OLD | NEW |