Index: ash/system/tray/tray_background_view.h |
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h |
index 363cea4ddcc12f4994de6ac17b5e67678d864619..2608506a9a3cde6923b833c0e14c583ddfdda9d6 100644 |
--- a/ash/system/tray/tray_background_view.h |
+++ b/ash/system/tray/tray_background_view.h |
@@ -13,6 +13,7 @@ |
namespace ash { |
namespace internal { |
+class StatusAreaWidget; |
class TrayBackground; |
// Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. |
@@ -23,7 +24,38 @@ class TrayBackground; |
class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, |
public BackgroundAnimatorDelegate { |
public: |
- TrayBackgroundView(); |
+ // Base class for tray containers. Sets the border and layout. The container |
+ // auto-resizes the widget when necessary. |
+ class TrayContainer : public views::View { |
+ public: |
+ explicit TrayContainer(ShelfAlignment alignment); |
+ virtual ~TrayContainer() {} |
+ |
+ void SetAlignment(ShelfAlignment alignment); |
+ |
+ void set_size(const gfx::Size& size) { size_ = size; } |
+ |
+ // Overridden from views::View. |
+ virtual gfx::Size GetPreferredSize(); |
+ |
+ protected: |
+ // Overridden from views::View. |
+ virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
+ virtual void ChildVisibilityChanged(View* child) OVERRIDE; |
+ virtual void ViewHierarchyChanged(bool is_add, |
+ View* parent, |
+ View* child) OVERRIDE; |
+ |
+ private: |
+ void UpdateLayout(); |
+ |
+ ShelfAlignment alignment_; |
+ gfx::Size size_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TrayContainer); |
+ }; |
+ |
+ explicit TrayBackgroundView(internal::StatusAreaWidget* status_area_widget); |
virtual ~TrayBackgroundView(); |
// Overridden from views::View. |
@@ -49,9 +81,21 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, |
bool value, |
internal::BackgroundAnimator::ChangeType change_type); |
+ StatusAreaWidget* status_area_widget() { |
+ return status_area_widget_; |
+ } |
+ TrayContainer* tray_container() const { return tray_container_; } |
ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
private: |
+ void SetBorder(); |
+ |
+ // Unowned pointer to parent widget. |
+ StatusAreaWidget* status_area_widget_; |
+ |
+ // Convenience pointer to the contents view. |
+ TrayContainer* tray_container_; |
+ |
// Shelf alignment. |
ShelfAlignment shelf_alignment_; |