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

Unified Diff: apps/shell_window.h

Issue 26751003: Factor out [min|max]_size into ShellWindow::SizeConstraints (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restrict this change to apps/ Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | apps/shell_window.cc » ('j') | apps/shell_window.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell_window.h
diff --git a/apps/shell_window.h b/apps/shell_window.h
index 3d42da76a162d54ba1d49bb8fe63edaf5b1bcef0..65e4f80a05dbfa588f2b737314071fe522a02a42 100644
--- a/apps/shell_window.h
+++ b/apps/shell_window.h
@@ -90,6 +90,37 @@ class ShellWindow : public content::NotificationObserver,
FRAME_NONE, // Frameless window.
};
+ class SizeConstraints {
+ public:
+ // The value SizeConstraints uses to represent an unbounded width or height.
+ static const int kUnboundedSize = 0;
tapted 2013/10/14 03:17:10 not sure if visual studio is happy with inline ini
jackhou1 2013/10/14 04:13:06 This type of declaration appears occassionally in
tapted 2013/10/14 05:13:43 Sweet - you're right! I think I sheriffed a link e
+
+ SizeConstraints();
+ SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size);
+ ~SizeConstraints();
+
+ // Returns the bounds with its size clamped to the min/max size.
+ gfx::Rect ClampBounds(const gfx::Rect& bounds) const;
+
+ // When gfx::Size is used as a min/max size, a zero represents an unbounded
+ // component. This method checks whether either component is specified.
+ // Note we can't use gfx::Size::IsEmpty as it returns true if either width
+ // or height is zero.
+ bool HasMinimumSize() const;
+ bool HasMaximumSize() const;
+
+ // This returns true if all components are specified, and min and max are
+ // equal.
+ bool MinAndMaxEqual() const;
tapted 2013/10/14 03:17:10 Perhaps `HasFixedSize`? But only if that's the onl
jackhou1 2013/10/14 04:13:06 Done.
+
+ gfx::Size minimum_size() const;
tapted 2013/10/14 03:17:10 nit: the the accessor functions should match the v
jackhou1 2013/10/14 04:13:06 Done.
+ gfx::Size maximum_size() const;
+
+ private:
+ gfx::Size min_size_;
+ gfx::Size max_size_;
+ };
+
struct CreateParams {
CreateParams();
~CreateParams();
@@ -382,6 +413,9 @@ class ShellWindow : public content::NotificationObserver,
// The window content is visible.
bool is_content_visible_;
+ // Size constraints on the window.
+ SizeConstraints size_constraints_;
+
DISALLOW_COPY_AND_ASSIGN(ShellWindow);
};
« no previous file with comments | « no previous file | apps/shell_window.cc » ('j') | apps/shell_window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698