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

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: Address comments 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..b79140f0376e95e7430f273be56befa2b9402cdc 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;
+
+ 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::Size ClampSize(gfx::Size size) 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 HasFixedSize() const;
+
+ gfx::Size GetMaximumSize() const;
+ gfx::Size GetMinimumSize() const;
+
+ private:
+ gfx::Size minimum_size_;
+ gfx::Size maximum_size_;
+ };
+
struct CreateParams {
CreateParams();
~CreateParams();
@@ -323,6 +354,11 @@ class ShellWindow : public content::NotificationObserver,
const gfx::Size& minimum_size,
gfx::Rect* bounds) const;
+ // Loads the appropriate default or cached window bounds and constraints them
tapted 2013/10/15 03:33:04 nit: constraints -> constrains (or clamps)
jackhou1 2013/10/15 05:07:13 Done.
+ // based on screen size and minimum/maximum size. Returns a new CreateParams
+ // that should be used to create the window.
+ CreateParams LoadDefaultsAndConstrain(CreateParams params) const;
+
// Load the app's image, firing a load state change when loaded.
void UpdateExtensionAppIcon();
« 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