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

Side by Side Diff: chrome/browser/ui/views/message_center/notification_bubble_wrapper.h

Issue 18003003: Message center re-organized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 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_H_
6 #define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_H_
7
8 #include "chrome/browser/ui/views/message_center/web_notification_tray.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 // NotificationBubbleWrapper is a class that manages the views associated
17 // with a MessageBubbleBase object and that notifies the WebNotificationTray
18 // when the widget closes. Delegates GetAnchorRect to the
19 // WebNotificationTray.
20 class NotificationBubbleWrapper : public views::WidgetObserver,
21 public views::TrayBubbleView::Delegate {
22 public:
23 enum BubbleType {
24 BUBBLE_TYPE_POPUP,
25 BUBBLE_TYPE_MESSAGE_CENTER,
26 };
27
28 NotificationBubbleWrapper(
29 WebNotificationTray* tray,
30 scoped_ptr<message_center::MessageBubbleBase> bubble,
31 BubbleType bubble_type);
32 virtual ~NotificationBubbleWrapper();
33
34 // Overridden from views::WidgetObserver.
35 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
36
37 // TrayBubbleView::Delegate implementation.
38 virtual void BubbleViewDestroyed() OVERRIDE;
39 virtual void OnMouseEnteredView() OVERRIDE;
40 virtual void OnMouseExitedView() OVERRIDE;
41 virtual string16 GetAccessibleNameForBubble() OVERRIDE;
42 // GetAnchorRect passes responsibility for BubbleDelegateView::GetAnchorRect
43 // to the delegate.
44 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget,
45 AnchorType anchor_type,
46 AnchorAlignment anchor_alignment) OVERRIDE;
47 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE;
48
49 // Convenience accessors.
50 views::TrayBubbleView* bubble_view() { return bubble_view_; }
51 views::Widget* bubble_widget() { return bubble_widget_; }
52 message_center::MessageBubbleBase* bubble() { return bubble_.get(); }
53
54 private:
55 scoped_ptr<message_center::MessageBubbleBase> bubble_;
56 const BubbleType bubble_type_;
57 // |bubble_view_| is owned by its Widget.
58 views::TrayBubbleView* bubble_view_;
59 views::Widget* bubble_widget_;
60 WebNotificationTray* tray_;
61
62 DISALLOW_COPY_AND_ASSIGN(NotificationBubbleWrapper);
63 };
64
65 } // namespace internal
66
67 } // namespace message_center
68
69 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_NOTIFICATION_BUBBLE_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698