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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | apps/shell_window.cc » ('j') | apps/shell_window.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SHELL_WINDOW_H_ 5 #ifndef APPS_SHELL_WINDOW_H_
6 #define APPS_SHELL_WINDOW_H_ 6 #define APPS_SHELL_WINDOW_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/extensions/extension_icon_image.h" 10 #include "chrome/browser/extensions/extension_icon_image.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). 83 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only).
84 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate 84 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate
85 // with v1 apps. 85 // with v1 apps.
86 }; 86 };
87 87
88 enum Frame { 88 enum Frame {
89 FRAME_CHROME, // Chrome-style window frame. 89 FRAME_CHROME, // Chrome-style window frame.
90 FRAME_NONE, // Frameless window. 90 FRAME_NONE, // Frameless window.
91 }; 91 };
92 92
93 class SizeConstraints {
94 public:
95 // The value SizeConstraints uses to represent an unbounded width or height.
96 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
97
98 SizeConstraints();
99 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size);
100 ~SizeConstraints();
101
102 // Returns the bounds with its size clamped to the min/max size.
103 gfx::Rect ClampBounds(const gfx::Rect& bounds) const;
104
105 // When gfx::Size is used as a min/max size, a zero represents an unbounded
106 // component. This method checks whether either component is specified.
107 // Note we can't use gfx::Size::IsEmpty as it returns true if either width
108 // or height is zero.
109 bool HasMinimumSize() const;
110 bool HasMaximumSize() const;
111
112 // This returns true if all components are specified, and min and max are
113 // equal.
114 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.
115
116 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.
117 gfx::Size maximum_size() const;
118
119 private:
120 gfx::Size min_size_;
121 gfx::Size max_size_;
122 };
123
93 struct CreateParams { 124 struct CreateParams {
94 CreateParams(); 125 CreateParams();
95 ~CreateParams(); 126 ~CreateParams();
96 127
97 WindowType window_type; 128 WindowType window_type;
98 Frame frame; 129 Frame frame;
99 bool transparent_background; // Only supported on ash. 130 bool transparent_background; // Only supported on ash.
100 131
101 // Specify the initial content bounds of the window (excluding any window 132 // Specify the initial content bounds of the window (excluding any window
102 // decorations). INT_MIN designates 'unspecified' for the position 133 // decorations). INT_MIN designates 'unspecified' for the position
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; 406 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_;
376 407
377 // Fullscreen entered by app.window api. 408 // Fullscreen entered by app.window api.
378 bool fullscreen_for_window_api_; 409 bool fullscreen_for_window_api_;
379 // Fullscreen entered by HTML requestFullscreen. 410 // Fullscreen entered by HTML requestFullscreen.
380 bool fullscreen_for_tab_; 411 bool fullscreen_for_tab_;
381 412
382 // The window content is visible. 413 // The window content is visible.
383 bool is_content_visible_; 414 bool is_content_visible_;
384 415
416 // Size constraints on the window.
417 SizeConstraints size_constraints_;
418
385 DISALLOW_COPY_AND_ASSIGN(ShellWindow); 419 DISALLOW_COPY_AND_ASSIGN(ShellWindow);
386 }; 420 };
387 421
388 } // namespace apps 422 } // namespace apps
389 423
390 #endif // APPS_SHELL_WINDOW_H_ 424 #endif // APPS_SHELL_WINDOW_H_
OLDNEW
« 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