OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "ash/system/tray/size_range_layout.h" | 7 #include "ash/system/tray/size_range_layout.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/views/layout/fill_layout.h" | 10 #include "ui/views/layout/fill_layout.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 | 13 |
14 // static | 14 // static |
15 | 15 |
16 const int SizeRangeLayout::kAbsoluteMinSize = 0; | 16 const int SizeRangeLayout::kAbsoluteMinSize = 0; |
17 const int SizeRangeLayout::kAbsoluteMaxSize = std::numeric_limits<int>::max(); | 17 const int SizeRangeLayout::kAbsoluteMaxSize = std::numeric_limits<int>::max(); |
18 | 18 |
19 // Non static | 19 // Non static |
20 | 20 |
21 SizeRangeLayout::SizeRangeLayout() | 21 SizeRangeLayout::SizeRangeLayout() |
22 : SizeRangeLayout(gfx::Size(kAbsoluteMinSize, kAbsoluteMinSize), | 22 : SizeRangeLayout(gfx::Size(kAbsoluteMinSize, kAbsoluteMinSize), |
23 gfx::Size(kAbsoluteMaxSize, kAbsoluteMaxSize)) {} | 23 gfx::Size(kAbsoluteMaxSize, kAbsoluteMaxSize)) {} |
24 | 24 |
| 25 SizeRangeLayout::SizeRangeLayout(const gfx::Size& size) |
| 26 : SizeRangeLayout(size, size) {} |
| 27 |
25 SizeRangeLayout::SizeRangeLayout(const gfx::Size& min_size, | 28 SizeRangeLayout::SizeRangeLayout(const gfx::Size& min_size, |
26 const gfx::Size& max_size) | 29 const gfx::Size& max_size) |
27 : layout_manager_(new views::FillLayout()), | 30 : layout_manager_(new views::FillLayout()), |
28 min_size_(gfx::Size(kAbsoluteMinSize, kAbsoluteMinSize)), | 31 min_size_(gfx::Size(kAbsoluteMinSize, kAbsoluteMinSize)), |
29 max_size_(gfx::Size(kAbsoluteMaxSize, kAbsoluteMaxSize)) { | 32 max_size_(gfx::Size(kAbsoluteMaxSize, kAbsoluteMaxSize)) { |
30 SetMinSize(min_size); | 33 SetMinSize(min_size); |
31 SetMaxSize(max_size); | 34 SetMaxSize(max_size); |
32 } | 35 } |
33 | 36 |
34 SizeRangeLayout::~SizeRangeLayout() {} | 37 SizeRangeLayout::~SizeRangeLayout() {} |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void SizeRangeLayout::ViewRemoved(views::View* host, views::View* view) { | 91 void SizeRangeLayout::ViewRemoved(views::View* host, views::View* view) { |
89 layout_manager_->ViewRemoved(host, view); | 92 layout_manager_->ViewRemoved(host, view); |
90 } | 93 } |
91 | 94 |
92 void SizeRangeLayout::ClampSizeToRange(gfx::Size* size) const { | 95 void SizeRangeLayout::ClampSizeToRange(gfx::Size* size) const { |
93 size->SetToMax(min_size_); | 96 size->SetToMax(min_size_); |
94 size->SetToMin(max_size_); | 97 size->SetToMin(max_size_); |
95 } | 98 } |
96 | 99 |
97 } // namespace ash | 100 } // namespace ash |
OLD | NEW |