Chromium Code Reviews| Index: ash/common/system/tray/tri_view.cc |
| diff --git a/ash/common/system/tray/tri_view.cc b/ash/common/system/tray/tri_view.cc |
| index ea2ca9327d8fc3a902f91dbca1a7114bd81c77b9..c71666f681bc39b58d5c72e550d78e0ccccd674a 100644 |
| --- a/ash/common/system/tray/tri_view.cc |
| +++ b/ash/common/system/tray/tri_view.cc |
| @@ -27,6 +27,18 @@ views::BoxLayout::Orientation GetOrientation(TriView::Orientation orientation) { |
| return views::BoxLayout::kHorizontal; |
| } |
| +// A View that will perform a layout if a child view's preferred size changes. |
| +class RelayoutView : public views::View { |
|
tdanderson
2016/11/28 21:47:37
Hm, I'm a bit surprised there isn't something like
|
| + public: |
| + RelayoutView() {} |
| + |
| + // views::View: |
| + void ChildPreferredSizeChanged(View* child) override { Layout(); } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(RelayoutView); |
| +}; |
| + |
| } // namespace |
| TriView::TriView() : TriView(0) {} |
| @@ -44,9 +56,9 @@ TriView::TriView(Orientation orientation, int padding_between_containers) |
| start_container_layout_manager_(new SizeRangeLayout), |
| center_container_layout_manager_(new SizeRangeLayout), |
| end_container_layout_manager_(new SizeRangeLayout) { |
| - AddChildView(new views::View); |
| - AddChildView(new views::View); |
| - AddChildView(new views::View); |
| + AddChildView(new RelayoutView); |
| + AddChildView(new RelayoutView); |
| + AddChildView(new RelayoutView); |
| GetContainer(Container::START) |
| ->SetLayoutManager(GetLayoutManager(Container::START)); |