| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/system/tray/tray_container.h" | 5 #include "ash/system/tray/tray_container.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/shelf/wm_shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| 11 #include "ui/gfx/geometry/insets.h" | 11 #include "ui/gfx/geometry/insets.h" |
| 12 #include "ui/views/border.h" | 12 #include "ui/views/border.h" |
| 13 #include "ui/views/layout/box_layout.h" | 13 #include "ui/views/layout/box_layout.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 | 16 |
| 17 TrayContainer::TrayContainer(WmShelf* wm_shelf) : wm_shelf_(wm_shelf) { | 17 TrayContainer::TrayContainer(Shelf* shelf) : shelf_(shelf) { |
| 18 DCHECK(wm_shelf_); | 18 DCHECK(shelf_); |
| 19 | 19 |
| 20 UpdateLayout(); | 20 UpdateLayout(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 TrayContainer::~TrayContainer() {} | 23 TrayContainer::~TrayContainer() {} |
| 24 | 24 |
| 25 void TrayContainer::UpdateAfterShelfAlignmentChange() { | 25 void TrayContainer::UpdateAfterShelfAlignmentChange() { |
| 26 UpdateLayout(); | 26 UpdateLayout(); |
| 27 } | 27 } |
| 28 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 PreferredSizeChanged(); | 40 PreferredSizeChanged(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TrayContainer::ViewHierarchyChanged( | 43 void TrayContainer::ViewHierarchyChanged( |
| 44 const ViewHierarchyChangedDetails& details) { | 44 const ViewHierarchyChangedDetails& details) { |
| 45 if (details.parent == this) | 45 if (details.parent == this) |
| 46 PreferredSizeChanged(); | 46 PreferredSizeChanged(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void TrayContainer::UpdateLayout() { | 49 void TrayContainer::UpdateLayout() { |
| 50 const bool is_horizontal = wm_shelf_->IsHorizontalAlignment(); | 50 const bool is_horizontal = shelf_->IsHorizontalAlignment(); |
| 51 | 51 |
| 52 // Adjust the size of status tray dark background by adding additional | 52 // Adjust the size of status tray dark background by adding additional |
| 53 // empty border. | 53 // empty border. |
| 54 views::BoxLayout::Orientation orientation = | 54 views::BoxLayout::Orientation orientation = |
| 55 is_horizontal ? views::BoxLayout::kHorizontal | 55 is_horizontal ? views::BoxLayout::kHorizontal |
| 56 : views::BoxLayout::kVertical; | 56 : views::BoxLayout::kVertical; |
| 57 | 57 |
| 58 const int hit_region_with_separator = kHitRegionPadding + kSeparatorWidth; | 58 const int hit_region_with_separator = kHitRegionPadding + kSeparatorWidth; |
| 59 gfx::Insets insets( | 59 gfx::Insets insets( |
| 60 is_horizontal | 60 is_horizontal |
| (...skipping 10 matching lines...) Expand all Loading... |
| 71 views::BoxLayout* layout = | 71 views::BoxLayout* layout = |
| 72 new views::BoxLayout(orientation, horizontal_margin, vertical_margin, 0); | 72 new views::BoxLayout(orientation, horizontal_margin, vertical_margin, 0); |
| 73 | 73 |
| 74 layout->set_minimum_cross_axis_size(kTrayItemSize); | 74 layout->set_minimum_cross_axis_size(kTrayItemSize); |
| 75 views::View::SetLayoutManager(layout); | 75 views::View::SetLayoutManager(layout); |
| 76 | 76 |
| 77 PreferredSizeChanged(); | 77 PreferredSizeChanged(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace ash | 80 } // namespace ash |
| OLD | NEW |