Index: ash/system/tray/tray_bubble_view.h |
diff --git a/ash/system/tray/tray_bubble_view.h b/ash/system/tray/tray_bubble_view.h |
index 61dfd8ecffd722e196a48e88662507bc2a872d6a..40074f9eea1650a2cdc3fa58ecff902312f34778 100644 |
--- a/ash/system/tray/tray_bubble_view.h |
+++ b/ash/system/tray/tray_bubble_view.h |
@@ -5,6 +5,7 @@ |
#ifndef ASH_SYSTEM_TRAY_TRAY_BUBBLE_VIEW_H_ |
#define ASH_SYSTEM_TRAY_TRAY_BUBBLE_VIEW_H_ |
+#include "ash/wm/shelf_types.h" |
#include "ui/aura/event_filter.h" |
#include "ui/views/bubble/bubble_delegate.h" |
@@ -24,15 +25,21 @@ namespace internal { |
// Mostly this handles custom anchor location and arrow and border rendering. |
class TrayBubbleView : public views::BubbleDelegateView { |
public: |
+ enum AnchorType { |
+ ANCHOR_TYPE_TRAY, |
+ ANCHOR_TYPE_BUBBLE |
+ }; |
+ |
class Host : public aura::EventFilter { |
public: |
Host(); |
virtual ~Host(); |
- void InitializeHost(views::Widget* widget, views::View* tray_view); |
+ void PostCreateBubble(views::Widget* widget, |
msw
2012/07/27 20:32:04
Add a comment; consider renaming InitBubble (natur
stevenjb
2012/07/30 20:09:03
Good suggestion, added comment and renamed Initial
|
+ TrayBubbleView* bubble_view, |
+ views::View* tray_view); |
virtual void BubbleViewDestroyed() = 0; |
- virtual gfx::Rect GetAnchorRect() const = 0; |
virtual void OnMouseEnteredView() = 0; |
virtual void OnMouseExitedView() = 0; |
virtual void OnClickedOutsideView() = 0; |
@@ -58,18 +65,28 @@ class TrayBubbleView : public views::BubbleDelegateView { |
DISALLOW_COPY_AND_ASSIGN(Host); |
}; |
- TrayBubbleView(views::View* anchor, |
- views::BubbleBorder::ArrowLocation arrow_location, |
- Host* host, |
- bool can_activate, |
- int bubble_width); |
- virtual ~TrayBubbleView(); |
+ struct InitParams { |
+ static const int kArrowDefaultOffset; |
+ |
+ InitParams(AnchorType anchor_type, |
+ ShelfAlignment shelf_alignment); |
+ AnchorType anchor_type; |
+ ShelfAlignment shelf_alignment; |
+ int bubble_width; |
+ int max_height; |
+ bool can_activate; |
+ int arrow_offset; |
+ SkColor arrow_color; |
+ }; |
- // Creates a bubble border with the specified arrow offset. |
- void SetBubbleBorder(int arrow_offset); |
+ static TrayBubbleView* Create(views::View* anchor, |
+ Host* host, |
+ const InitParams& init_params); |
- // Called whenever the bubble anchor location may have moved. |
- void UpdateAnchor(); |
+ virtual ~TrayBubbleView(); |
+ |
+ // Called whenever the bubble size or location may have moved. |
msw
2012/07/27 20:32:04
nit: s/moved/changed/
stevenjb
2012/07/30 20:09:03
Done.
|
+ void UpdateBubble(); |
// Sets the maximum bubble height and resizes the bubble. |
void SetMaxHeight(int height); |
@@ -79,6 +96,8 @@ class TrayBubbleView : public views::BubbleDelegateView { |
// Overridden from views::WidgetDelegate. |
virtual bool CanActivate() const OVERRIDE; |
+ virtual views::NonClientFrameView* CreateNonClientFrameView( |
+ views::Widget* widget) OVERRIDE; |
// Overridden from views::BubbleDelegateView. |
virtual gfx::Rect GetAnchorRect() OVERRIDE; |
@@ -90,6 +109,11 @@ class TrayBubbleView : public views::BubbleDelegateView { |
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
protected: |
+ TrayBubbleView(const InitParams& init_params, |
+ views::BubbleBorder::ArrowLocation arrow_location, |
+ views::View* anchor, |
+ Host* host); |
+ |
// Overridden from views::BubbleDelegateView. |
virtual void Init() OVERRIDE; |
virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
@@ -101,10 +125,8 @@ class TrayBubbleView : public views::BubbleDelegateView { |
views::View* child) OVERRIDE; |
private: |
+ InitParams params_; |
Host* host_; |
- bool can_activate_; |
- int max_height_; |
- int bubble_width_; |
DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
}; |