aw: Remove aw_switches
[chromium-blink-merge.git] / apps / size_constraints.h
blob353037bb46fd0e72fbf36c95449905446fecd97d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef APPS_SIZE_CONSTRAINTS_H_
6 #define APPS_SIZE_CONSTRAINTS_H_
8 #include "ui/gfx/geometry/size.h"
10 namespace gfx {
11 class Insets;
14 namespace apps {
16 class SizeConstraints {
17 public:
18 // The value SizeConstraints uses to represent an unbounded width or height.
19 // This is an enum so that it can be declared inline here.
20 enum { kUnboundedSize = 0 };
22 SizeConstraints();
23 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size);
24 ~SizeConstraints();
26 // Adds frame insets to a size constraint.
27 static gfx::Size AddFrameToConstraints(const gfx::Size& size_constraints,
28 const gfx::Insets& frame_insets);
30 // Returns the bounds with its size clamped to the min/max size.
31 gfx::Size ClampSize(gfx::Size size) const;
33 // When gfx::Size is used as a min/max size, a zero represents an unbounded
34 // component. This method checks whether either component is specified.
35 // Note we can't use gfx::Size::IsEmpty as it returns true if either width
36 // or height is zero.
37 bool HasMinimumSize() const;
38 bool HasMaximumSize() const;
40 // This returns true if all components are specified, and min and max are
41 // equal.
42 bool HasFixedSize() const;
44 gfx::Size GetMaximumSize() const;
45 gfx::Size GetMinimumSize() const;
47 void set_minimum_size(const gfx::Size& min_size);
48 void set_maximum_size(const gfx::Size& max_size);
50 private:
51 gfx::Size minimum_size_;
52 gfx::Size maximum_size_;
55 } // namespace apps
57 #endif // APPS_SIZE_CONSTRAINTS_H_