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 message_center { |
| 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( |
| 26 WebNotificationTrayWin* tray, |
| 27 scoped_ptr<message_center::MessageBubbleBase> bubble, |
| 28 AnchorType anchor_type); |
| 29 virtual ~NotificationBubbleWrapperWin(); |
| 30 |
| 31 // Overridden from views::WidgetObserver. |
| 32 void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 33 |
| 34 // TrayBubbleView::Delegate implementation. |
| 35 virtual void BubbleViewDestroyed() OVERRIDE; |
| 36 virtual void OnMouseEnteredView() OVERRIDE; |
| 37 virtual void OnMouseExitedView() OVERRIDE; |
| 38 virtual string16 GetAccessibleNameForBubble() OVERRIDE; |
| 39 // GetAnchorRect passes responsibility for BubbleDelegateView::GetAnchorRect |
| 40 // to the delegate. |
| 41 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
| 42 AnchorType anchor_type, |
| 43 AnchorAlignment anchor_alignment) OVERRIDE; |
| 44 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE; |
| 45 |
| 46 // Convenience accessors. |
| 47 views::TrayBubbleView* bubble_view() { return bubble_view_; } |
| 48 views::Widget* bubble_widget() { return bubble_widget_; } |
| 49 message_center::MessageBubbleBase* bubble() { return bubble_.get(); } |
| 50 |
| 51 private: |
| 52 scoped_ptr<message_center::MessageBubbleBase> bubble_; |
| 53 // |bubble_view_| is owned by its Widget. |
| 54 views::TrayBubbleView* bubble_view_; |
| 55 views::Widget* bubble_widget_; |
| 56 WebNotificationTrayWin* tray_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(NotificationBubbleWrapperWin); |
| 59 }; |
| 60 |
| 61 } // namespace internal |
| 62 |
| 63 } // namespace message_center |
| 64 |
| 65 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WI
N_H_ |
OLD | NEW |