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.
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_
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"
12 namespace message_center
{
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
{
24 // Takes ownership of |bubble|.
25 NotificationBubbleWrapperWin(
26 WebNotificationTrayWin
* tray
,
27 scoped_ptr
<message_center::MessageBubbleBase
> bubble
,
28 AnchorType anchor_type
);
29 virtual ~NotificationBubbleWrapperWin();
31 // Overridden from views::WidgetObserver.
32 void OnWidgetDestroying(views::Widget
* widget
) OVERRIDE
;
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
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
;
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(); }
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_
;
58 DISALLOW_COPY_AND_ASSIGN(NotificationBubbleWrapperWin
);
61 } // namespace internal
63 } // namespace message_center
65 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WIN_H_