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(WebNotificationTrayWin* tray, | |
26 message_center::MessageBubbleBase* bubble, | |
sky
2013/01/30 14:38:17
Pass in as scoped_ptr so ownership if clear.
dewittj
2013/01/30 23:08:32
Done.
| |
27 AnchorType anchor_type); | |
28 ~NotificationBubbleWrapperWin(); | |
sky
2013/01/30 14:38:17
virtual
dewittj
2013/01/30 23:08:32
Done.
| |
29 | |
30 // Overridden from views::WidgetObserver. | |
31 void OnWidgetClosing(views::Widget* widget) OVERRIDE; | |
32 | |
33 // TrayBubbleView::Delegate implementation. | |
34 virtual void BubbleViewDestroyed() OVERRIDE; | |
35 virtual void OnMouseEnteredView() OVERRIDE; | |
36 virtual void OnMouseExitedView() OVERRIDE; | |
37 virtual string16 GetAccessibleNameForBubble() OVERRIDE; | |
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) OVERRIDE; | |
43 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE; | |
44 | |
45 // Convenience accessors. | |
46 views::TrayBubbleView* bubble_view() const { return bubble_view_; } | |
sky
2013/01/30 14:38:17
in general const methods shouldn't return non-cons
dewittj
2013/01/30 23:08:32
Done.
| |
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 owned by its Widget. | |
53 views::TrayBubbleView* bubble_view_; | |
54 views::Widget* bubble_widget_; | |
55 WebNotificationTrayWin* tray_; | |
56 }; | |
sky
2013/01/30 14:38:17
DISALLOW_...
dewittj
2013/01/30 23:08:32
Done.
| |
57 | |
58 } // namespace internal | |
59 | |
60 } // namespace message_center | |
61 | |
62 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_WI N_H_ | |
OLD | NEW |