| 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 195f08fe686bc470705b7d7123faf77775215794..dbd31ea2d27fecb36f90d4b4cbe94aa7cc573768 100644
|
| --- a/ash/system/tray/tray_bubble_view.h
|
| +++ b/ash/system/tray/tray_bubble_view.h
|
| @@ -5,8 +5,6 @@
|
| #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"
|
|
|
| namespace ui {
|
| @@ -19,7 +17,6 @@ class Widget;
|
| }
|
|
|
| namespace ash {
|
| -namespace internal {
|
|
|
| class TrayBubbleBorder;
|
| class TrayBubbleBackground;
|
| @@ -33,83 +30,78 @@ class TrayBubbleView : public views::BubbleDelegateView {
|
| ANCHOR_TYPE_BUBBLE
|
| };
|
|
|
| - class Host : public aura::EventFilter {
|
| + enum AnchorAlignment {
|
| + ANCHOR_ALIGNMENT_BOTTOM,
|
| + ANCHOR_ALIGNMENT_LEFT,
|
| + ANCHOR_ALIGNMENT_RIGHT
|
| + };
|
| +
|
| + class Delegate {
|
| public:
|
| - Host();
|
| - virtual ~Host();
|
| + typedef TrayBubbleView::AnchorType AnchorType;
|
| + typedef TrayBubbleView::AnchorAlignment AnchorAlignment;
|
|
|
| - // Set widget_ and tray_view_, set up animations, and show the bubble.
|
| - // Must occur after bubble_view->CreateBubble() is called.
|
| - void InitializeAndShowBubble(views::Widget* widget,
|
| - TrayBubbleView* bubble_view,
|
| - views::View* tray_view);
|
| + Delegate() {}
|
| + virtual ~Delegate() {}
|
|
|
| virtual void BubbleViewDestroyed() = 0;
|
| virtual void OnMouseEnteredView() = 0;
|
| virtual void OnMouseExitedView() = 0;
|
| - virtual void OnClickedOutsideView() = 0;
|
| virtual string16 GetAccessibleName() = 0;
|
| -
|
| - // Overridden from aura::EventFilter.
|
| - virtual bool PreHandleKeyEvent(aura::Window* target,
|
| - ui::KeyEvent* event) OVERRIDE;
|
| - virtual bool PreHandleMouseEvent(aura::Window* target,
|
| - ui::MouseEvent* event) OVERRIDE;
|
| - virtual ui::TouchStatus PreHandleTouchEvent(
|
| - aura::Window* target,
|
| - ui::TouchEvent* event) OVERRIDE;
|
| - virtual ui::EventResult PreHandleGestureEvent(
|
| - aura::Window* target,
|
| - ui::GestureEvent* event) OVERRIDE;
|
| + virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget,
|
| + AnchorType anchor_type,
|
| + AnchorAlignment anchor_alignment) = 0;
|
|
|
| private:
|
| - void ProcessLocatedEvent(aura::Window* target,
|
| - const ui::LocatedEvent& event);
|
| -
|
| - views::Widget* widget_;
|
| - TrayBubbleView* bubble_view_;
|
| - views::View* tray_view_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(Host);
|
| + DISALLOW_COPY_AND_ASSIGN(Delegate);
|
| };
|
|
|
| struct InitParams {
|
| static const int kArrowDefaultOffset;
|
|
|
| InitParams(AnchorType anchor_type,
|
| - ShelfAlignment shelf_alignment);
|
| + AnchorAlignment anchor_alignment,
|
| + int bubble_width);
|
| AnchorType anchor_type;
|
| - ShelfAlignment shelf_alignment;
|
| + AnchorAlignment anchor_alignment;
|
| int bubble_width;
|
| int max_height;
|
| bool can_activate;
|
| bool close_on_deactivate;
|
| SkColor top_color;
|
| SkColor arrow_color;
|
| + views::BubbleBorder::ArrowLocation arrow_location;
|
| int arrow_offset;
|
| views::BubbleBorder::Shadow shadow;
|
| };
|
|
|
| - static TrayBubbleView* Create(views::View* anchor,
|
| - Host* host,
|
| - const InitParams& init_params);
|
| + // Constructs and returns a TrayBubbleView. init_params may be modified.
|
| + static TrayBubbleView* Create(aura::Window* parent_window,
|
| + views::View* anchor,
|
| + Delegate* delegate,
|
| + InitParams* init_params);
|
|
|
| virtual ~TrayBubbleView();
|
|
|
| + // Sets up animations, and show the bubble. Must occur after CreateBubble()
|
| + // is called.
|
| + void InitializeAndShowBubble();
|
| +
|
| // Called whenever the bubble size or location may have changed.
|
| void UpdateBubble();
|
|
|
| // Sets the maximum bubble height and resizes the bubble.
|
| void SetMaxHeight(int height);
|
|
|
| - // Called when the host is destroyed.
|
| - void reset_host() { host_ = NULL; }
|
| + // Returns the border insets. Called by TrayEventFilter.
|
| + void GetBorderInsets(gfx::Insets* insets) const;
|
| +
|
| + // Called when the delegate is destroyed.
|
| + void reset_delegate() { delegate_ = NULL; }
|
|
|
| void set_gesture_dragging(bool dragging) { is_gesture_dragging_ = dragging; }
|
| bool is_gesture_dragging() const { return is_gesture_dragging_; }
|
|
|
| - TrayBubbleBorder* bubble_border() { return bubble_border_; }
|
| -
|
| // Overridden from views::WidgetDelegate.
|
| virtual bool CanActivate() const OVERRIDE;
|
| virtual views::NonClientFrameView* CreateNonClientFrameView(
|
| @@ -127,10 +119,10 @@ class TrayBubbleView : public views::BubbleDelegateView {
|
| virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
|
|
|
| protected:
|
| - TrayBubbleView(const InitParams& init_params,
|
| - views::BubbleBorder::ArrowLocation arrow_location,
|
| + TrayBubbleView(aura::Window* parent_window,
|
| views::View* anchor,
|
| - Host* host);
|
| + Delegate* delegate,
|
| + const InitParams& init_params);
|
|
|
| // Overridden from views::BubbleDelegateView.
|
| virtual void Init() OVERRIDE;
|
| @@ -143,7 +135,7 @@ class TrayBubbleView : public views::BubbleDelegateView {
|
|
|
| private:
|
| InitParams params_;
|
| - Host* host_;
|
| + Delegate* delegate_;
|
| TrayBubbleBorder* bubble_border_;
|
| TrayBubbleBackground* bubble_background_;
|
| bool is_gesture_dragging_;
|
| @@ -151,7 +143,6 @@ class TrayBubbleView : public views::BubbleDelegateView {
|
| DISALLOW_COPY_AND_ASSIGN(TrayBubbleView);
|
| };
|
|
|
| -} // namespace internal
|
| } // namespace ash
|
|
|
| #endif // ASH_SYSTEM_TRAY_TRAY_BUBBLE_VIEW_H_
|
|
|