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

Unified Diff: apps/app_window.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, 10 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/app_window.cc » ('j') | apps/app_window.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_window.h
diff --git a/apps/app_window.h b/apps/app_window.h
index 8403153d2741abd098210fb20abbb51dbeebc66c..7288309e1ab029f401315c967fa44efa4250006f 100644
--- a/apps/app_window.h
+++ b/apps/app_window.h
@@ -116,6 +116,25 @@ class AppWindow : public content::NotificationObserver,
FULLSCREEN_TYPE_FORCED = 1 << 3,
};
+ struct BoundsSpecification {
+ // INT_MIN represents an unspecified position component.
+ static const int kUnspecifiedPosition;
+
+ BoundsSpecification();
+ ~BoundsSpecification();
+
+ // INT_MIN designates 'unspecified' for the position components, and 0 for
benwells 2014/03/05 02:33:30 Does INT_MIN mean 0 for size, or does 0 mean unspe
tmdiep 2014/03/05 03:06:47 I'll reword this comment. INT_MIN means unspecifie
+ // the size components. When unspecified, they should be replaced with a
+ // default value.
+ gfx::Rect bounds;
+
+ gfx::Size minimum_size;
+ gfx::Size maximum_size;
+
+ // Reset the bounds fields to their 'unspecified' values.
tapted 2014/03/05 03:14:03 nit: mention that minimum/maximum size are unchang
+ void ResetBounds();
+ };
+
struct CreateParams {
CreateParams();
~CreateParams();
@@ -127,14 +146,13 @@ class AppWindow : public content::NotificationObserver,
SkColor frame_color;
bool transparent_background; // Only supported on ash.
- // Specify the initial content bounds of the window (excluding any window
- // decorations). INT_MIN designates 'unspecified' for the position
- // components, and 0 for the size components. When unspecified, they should
- // be replaced with a default value.
- gfx::Rect bounds;
+ // The initial content/inner bounds specification (excluding any window
+ // decorations).
+ BoundsSpecification content_spec;
- gfx::Size minimum_size;
- gfx::Size maximum_size;
+ // The initial window/outer bounds specification (including window
+ // decorations).
+ BoundsSpecification window_spec;
std::string window_key;
@@ -156,6 +174,19 @@ class AppWindow : public content::NotificationObserver,
// If true, the window will stay on top of other windows that are not
// configured to be always on top. Defaults to false.
bool always_on_top;
+
+ // The API enables developers to specify content or window bounds. This
+ // function combines them into a single, constrained window size. Note that
+ // until the frame insets are known, the returned value is just an estimate.
benwells 2014/03/05 02:33:30 I don't understand the comment about frame insets.
tmdiep 2014/03/05 03:06:47 We need the window created first to get the real f
+ gfx::Rect GetInitialWindowBounds(const gfx::Insets& frame_insets) const;
+
+ // The API enables developers to specify content or window size constraints.
+ // These functions combine them so that we can work with one set of
+ // constraints.
+ gfx::Size GetContentMinimumSize(const gfx::Insets& frame_insets) const;
+ gfx::Size GetContentMaximumSize(const gfx::Insets& frame_insets) const;
+ gfx::Size GetWindowMinimumSize(const gfx::Insets& frame_insets) const;
+ gfx::Size GetWindowMaximumSize(const gfx::Insets& frame_insets) const;
};
class Delegate {
@@ -289,9 +320,9 @@ class AppWindow : public content::NotificationObserver,
// details.
void ForcedFullscreen();
- // Set the minimum and maximum size that this window is allowed to be.
- void SetMinimumSize(const gfx::Size& min_size);
- void SetMaximumSize(const gfx::Size& max_size);
+ // Set the minimum and maximum size of the content bounds.
+ void SetContentMinimumSize(const gfx::Size& min_size);
+ void SetContentMaximumSize(const gfx::Size& max_size);
enum ShowType { SHOW_ACTIVE, SHOW_INACTIVE };
@@ -396,17 +427,16 @@ class AppWindow : public content::NotificationObserver,
void SaveWindowPosition();
// Helper method to adjust the cached bounds so that we can make sure it can
- // be visible on the screen. See http://crbug.com/145752 .
+ // be visible on the screen. See http://crbug.com/145752.
void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds,
const gfx::Rect& cached_screen_bounds,
const gfx::Rect& current_screen_bounds,
const gfx::Size& minimum_size,
gfx::Rect* bounds) const;
- // Loads the appropriate default or cached window bounds and constrains them
- // 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;
+ // Loads the appropriate default or cached window bounds. Returns a new
+ // CreateParams that should be used to create the window.
+ CreateParams LoadDefaults(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/app_window.cc » ('j') | apps/app_window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698