Chromium Code Reviews| Index: apps/shell_window.h |
| diff --git a/apps/shell_window.h b/apps/shell_window.h |
| index 3d42da76a162d54ba1d49bb8fe63edaf5b1bcef0..7e52548d9025b79f038483e6311b66ceb81b3fe0 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::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 HasFixedSize() const; |
| + |
| + gfx::Size minimum_size() const; |
| + gfx::Size maximum_size() const; |
| + |
| + private: |
| + gfx::Size minimum_size_; |
| + gfx::Size maximum_size_; |
| + }; |
| + |
| struct CreateParams { |
| CreateParams(); |
| ~CreateParams(); |
| @@ -326,6 +357,12 @@ class ShellWindow : public content::NotificationObserver, |
| // Load the app's image, firing a load state change when loaded. |
| void UpdateExtensionAppIcon(); |
| + // Loads the appropriate default or cached window bounds and constraints them |
| + // based on screen size and minimum/maximum size. Returns a new CreateParams |
| + // that should be used to create the window. |
| + CreateParams LoadDefaultsAndConstrain( |
|
tapted
2013/10/14 05:13:43
Hm.. the non-overrides are already mixed in with a
jackhou1
2013/10/14 23:45:32
Done.
|
| + const CreateParams& create_params) const; |
| + |
| // extensions::ExtensionKeybindingRegistry::Delegate implementation. |
| virtual extensions::ActiveTabPermissionGranter* |
| GetActiveTabPermissionGranter() OVERRIDE; |
| @@ -382,6 +419,9 @@ class ShellWindow : public content::NotificationObserver, |
| // The window content is visible. |
| bool is_content_visible_; |
| + // Size constraints on the window. |
| + SizeConstraints size_constraints_; |
|
tapted
2013/10/14 05:13:43
maybe move this to the next CL
jackhou1
2013/10/14 23:45:32
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
| }; |