Chromium Code Reviews| Index: ash/system/tray/system_tray_bubble_view.h |
| diff --git a/ash/system/tray/system_tray_bubble_view.h b/ash/system/tray/system_tray_bubble_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..194cadb76394271df27c8e0331011bc2b16121b9 |
| --- /dev/null |
| +++ b/ash/system/tray/system_tray_bubble_view.h |
| @@ -0,0 +1,77 @@ |
| +#ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_ |
| +#define ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_ |
| +#pragma once |
| + |
| +#include "ui/views/bubble/bubble_delegate.h" |
| + |
| +namespace views { |
| +class View; |
| +} |
| + |
| +namespace ash { |
| +namespace internal { |
| + |
| +// Specialized bubble view for system and web notification bubbles. |
| +// Mostly this handles custom anchor location and arrow and border rendering. |
| +class SystemTrayBubbleView : public views::BubbleDelegateView { |
| + public: |
| + class Host { |
| + public: |
| + Host() {} |
| + virtual ~Host() {} |
| + |
| + virtual void BubbleViewDestroyed() = 0; |
| + virtual gfx::Rect GetAnchorRect() const = 0; |
| + virtual void OnMouseEnteredView() = 0; |
| + virtual void OnMoiseExitedView() = 0; |
|
jennyz
2012/06/06 21:04:38
Typo: Moise->Mouse
stevenjb
2012/06/06 23:12:15
Done.
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Host); |
| + }; |
| + |
| + SystemTrayBubbleView(views::View* anchor, |
| + views::BubbleBorder::ArrowLocation arrow_location, |
| + Host* host, |
| + bool can_activate); |
| + virtual ~SystemTrayBubbleView(); |
| + |
| + void SetBubbleBorder(int arrow_offset); |
| + void UpdateAnchor(); |
| + void SetMaxHeight(int height); |
| + |
| + // Called when the host is destroyed. |
| + void reset_host() { host_ = NULL; } |
| + |
| + void set_bubble_width(int width) { bubble_width_ = width; } |
| + |
| + protected: |
| + // Overridden from views::WidgetDelegate. |
| + virtual bool CanActivate() const OVERRIDE; |
| + |
| + // Overridden from views::BubbleDelegateView. |
| + virtual void Init() OVERRIDE; |
| + virtual gfx::Rect GetAnchorRect() OVERRIDE; |
| + virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
| + |
| + // Overridden from views::View. |
| + virtual gfx::Size GetPreferredSize() OVERRIDE; |
| + virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
| + virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
| + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| + virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| + virtual void ViewHierarchyChanged(bool is_add, |
| + views::View* parent, |
| + views::View* child) OVERRIDE; |
| + |
| + Host* host_; |
| + bool can_activate_; |
| + int max_height_; |
| + int bubble_width_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace ash |
| + |
| +#endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_ |