OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/border.h" | 5 #include "ui/views/border.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 gfx::Insets BorderPainter::GetInsets() const { | 200 gfx::Insets BorderPainter::GetInsets() const { |
201 return insets_; | 201 return insets_; |
202 } | 202 } |
203 | 203 |
204 gfx::Size BorderPainter::GetMinimumSize() const { | 204 gfx::Size BorderPainter::GetMinimumSize() const { |
205 return painter_->GetMinimumSize(); | 205 return painter_->GetMinimumSize(); |
206 } | 206 } |
207 | 207 |
208 } // namespace | 208 } // namespace |
209 | 209 |
210 Border::Border() { | 210 Border::Border() {} |
211 } | |
212 | 211 |
213 Border::~Border() { | 212 Border::~Border() {} |
214 } | |
215 | 213 |
216 // static | 214 std::unique_ptr<Border> NullBorder() { |
217 std::unique_ptr<Border> Border::NullBorder() { | |
218 return nullptr; | 215 return nullptr; |
219 } | 216 } |
220 | 217 |
221 // static | 218 std::unique_ptr<Border> CreateSolidBorder(int thickness, SkColor color) { |
222 std::unique_ptr<Border> Border::CreateSolidBorder(int thickness, | |
223 SkColor color) { | |
224 return base::MakeUnique<SolidSidedBorder>(gfx::Insets(thickness), color); | 219 return base::MakeUnique<SolidSidedBorder>(gfx::Insets(thickness), color); |
225 } | 220 } |
226 | 221 |
227 // static | 222 std::unique_ptr<Border> CreateEmptyBorder(const gfx::Insets& insets) { |
228 std::unique_ptr<Border> Border::CreateEmptyBorder(const gfx::Insets& insets) { | |
229 return base::MakeUnique<EmptyBorder>(insets); | 223 return base::MakeUnique<EmptyBorder>(insets); |
230 } | 224 } |
231 | 225 |
232 // static | 226 std::unique_ptr<Border> CreateRoundedRectBorder(int thickness, |
233 std::unique_ptr<Border> Border::CreateRoundedRectBorder(int thickness, | 227 int corner_radius, |
234 int corner_radius, | 228 SkColor color) { |
235 SkColor color) { | |
236 return base::MakeUnique<RoundedRectBorder>(thickness, corner_radius, color); | 229 return base::MakeUnique<RoundedRectBorder>(thickness, corner_radius, color); |
237 } | 230 } |
238 | 231 |
239 // static | 232 std::unique_ptr<Border> CreateEmptyBorder(int top, |
240 std::unique_ptr<Border> Border::CreateEmptyBorder(int top, | 233 int left, |
241 int left, | 234 int bottom, |
242 int bottom, | 235 int right) { |
243 int right) { | |
244 return CreateEmptyBorder(gfx::Insets(top, left, bottom, right)); | 236 return CreateEmptyBorder(gfx::Insets(top, left, bottom, right)); |
245 } | 237 } |
246 | 238 |
247 // static | 239 std::unique_ptr<Border> CreateSolidSidedBorder(int top, |
248 std::unique_ptr<Border> Border::CreateSolidSidedBorder(int top, | 240 int left, |
249 int left, | 241 int bottom, |
250 int bottom, | 242 int right, |
251 int right, | 243 SkColor color) { |
252 SkColor color) { | |
253 return base::MakeUnique<SolidSidedBorder>( | 244 return base::MakeUnique<SolidSidedBorder>( |
254 gfx::Insets(top, left, bottom, right), color); | 245 gfx::Insets(top, left, bottom, right), color); |
255 } | 246 } |
256 | 247 |
257 // static | 248 // static |
258 std::unique_ptr<Border> Border::CreatePaddedBorder( | 249 std::unique_ptr<Border> CreatePaddedBorder(std::unique_ptr<Border> border, |
259 std::unique_ptr<Border> border, | 250 const gfx::Insets& insets) { |
260 const gfx::Insets& insets) { | |
261 return base::MakeUnique<ExtraInsetsBorder>(std::move(border), insets); | 251 return base::MakeUnique<ExtraInsetsBorder>(std::move(border), insets); |
262 } | 252 } |
263 | 253 |
264 // static | 254 // static |
265 std::unique_ptr<Border> Border::CreateBorderPainter( | 255 std::unique_ptr<Border> CreateBorderPainter(std::unique_ptr<Painter> painter, |
266 std::unique_ptr<Painter> painter, | 256 const gfx::Insets& insets) { |
267 const gfx::Insets& insets) { | |
268 return base::WrapUnique(new BorderPainter(std::move(painter), insets)); | 257 return base::WrapUnique(new BorderPainter(std::move(painter), insets)); |
269 } | 258 } |
270 | 259 |
271 } // namespace views | 260 } // namespace views |
OLD | NEW |