Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: apps/size_constraints.h

Issue 186343002: Create windows for new app window bounds API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self nit: comment Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef APPS_SIZE_CONSTRAINTS_H_ 5 #ifndef APPS_SIZE_CONSTRAINTS_H_
6 #define APPS_SIZE_CONSTRAINTS_H_ 6 #define APPS_SIZE_CONSTRAINTS_H_
7 7
8 #include "ui/gfx/geometry/size.h" 8 #include "ui/gfx/geometry/size.h"
9 #include "ui/gfx/insets.h"
tapted 2014/03/05 03:14:03 nit: since it's not a member, this can be forward-
9 10
10 namespace apps { 11 namespace apps {
11 12
12 class SizeConstraints { 13 class SizeConstraints {
13 public: 14 public:
14 // The value SizeConstraints uses to represent an unbounded width or height. 15 // The value SizeConstraints uses to represent an unbounded width or height.
15 // This is an enum so that it can be declared inline here. 16 // This is an enum so that it can be declared inline here.
16 enum { kUnboundedSize = 0 }; 17 enum { kUnboundedSize = 0 };
17 18
18 SizeConstraints(); 19 SizeConstraints();
19 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size); 20 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size);
20 ~SizeConstraints(); 21 ~SizeConstraints();
21 22
23 // Applies frame insets to a size constraint.
24 static gfx::Size InsetConstraints(const gfx::Size& size_constraints,
25 const gfx::Insets& frame_insets);
26
22 // Returns the bounds with its size clamped to the min/max size. 27 // Returns the bounds with its size clamped to the min/max size.
23 gfx::Size ClampSize(gfx::Size size) const; 28 gfx::Size ClampSize(gfx::Size size) const;
24 29
25 // When gfx::Size is used as a min/max size, a zero represents an unbounded 30 // When gfx::Size is used as a min/max size, a zero represents an unbounded
26 // component. This method checks whether either component is specified. 31 // component. This method checks whether either component is specified.
27 // Note we can't use gfx::Size::IsEmpty as it returns true if either width 32 // Note we can't use gfx::Size::IsEmpty as it returns true if either width
28 // or height is zero. 33 // or height is zero.
29 bool HasMinimumSize() const; 34 bool HasMinimumSize() const;
30 bool HasMaximumSize() const; 35 bool HasMaximumSize() const;
31 36
32 // This returns true if all components are specified, and min and max are 37 // This returns true if all components are specified, and min and max are
33 // equal. 38 // equal.
34 bool HasFixedSize() const; 39 bool HasFixedSize() const;
35 40
36 gfx::Size GetMaximumSize() const; 41 gfx::Size GetMaximumSize() const;
37 gfx::Size GetMinimumSize() const; 42 gfx::Size GetMinimumSize() const;
38 43
39 void set_minimum_size(const gfx::Size& min_size); 44 void set_minimum_size(const gfx::Size& min_size);
40 void set_maximum_size(const gfx::Size& max_size); 45 void set_maximum_size(const gfx::Size& max_size);
41 46
42 private: 47 private:
43 gfx::Size minimum_size_; 48 gfx::Size minimum_size_;
44 gfx::Size maximum_size_; 49 gfx::Size maximum_size_;
45 }; 50 };
46 51
47 } // namespace apps 52 } // namespace apps
48 53
49 #endif // APPS_SIZE_CONSTRAINTS_H_ 54 #endif // APPS_SIZE_CONSTRAINTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698