OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/gfx/insets.h" | 9 #include "ui/gfx/insets.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 | 12 |
13 // This class knows how to resize both DevTools and inspected WebContents | 13 // This class knows how to resize both DevTools and inspected WebContents |
14 // inside a browser window hierarchy. | 14 // inside a browser window hierarchy. |
15 class DevToolsContentsResizingStrategy { | 15 class DevToolsContentsResizingStrategy { |
16 public: | 16 public: |
17 DevToolsContentsResizingStrategy(); | 17 DevToolsContentsResizingStrategy(); |
18 DevToolsContentsResizingStrategy( | 18 explicit DevToolsContentsResizingStrategy( |
19 const gfx::Insets& insets, | 19 const gfx::Rect& bounds); |
20 const gfx::Size& min_size); | |
21 explicit DevToolsContentsResizingStrategy(const gfx::Rect& bounds); | |
22 | 20 |
23 void CopyFrom(const DevToolsContentsResizingStrategy& strategy); | 21 void CopyFrom(const DevToolsContentsResizingStrategy& strategy); |
24 bool Equals(const DevToolsContentsResizingStrategy& strategy); | 22 bool Equals(const DevToolsContentsResizingStrategy& strategy); |
25 | 23 |
26 const gfx::Insets& insets() const { return insets_; } | |
27 const gfx::Size& min_size() const { return min_size_; } | |
28 const gfx::Rect& bounds() const { return bounds_; } | 24 const gfx::Rect& bounds() const { return bounds_; } |
| 25 bool hide_inspected_contents() const { return hide_inspected_contents_; } |
29 | 26 |
30 private: | 27 private: |
31 // Insets of contents inside DevTools. | |
32 gfx::Insets insets_; | |
33 | |
34 // Minimum size of contents. | |
35 gfx::Size min_size_; | |
36 | |
37 // Contents bounds. When non-empty, used instead of insets. | 28 // Contents bounds. When non-empty, used instead of insets. |
38 gfx::Rect bounds_; | 29 gfx::Rect bounds_; |
39 | 30 |
| 31 // Determines whether inspected contents is visible. |
| 32 bool hide_inspected_contents_; |
| 33 |
40 DISALLOW_COPY_AND_ASSIGN(DevToolsContentsResizingStrategy); | 34 DISALLOW_COPY_AND_ASSIGN(DevToolsContentsResizingStrategy); |
41 }; | 35 }; |
42 | 36 |
43 // Applies contents resizing strategy, producing bounds for devtools and | 37 // Applies contents resizing strategy, producing bounds for devtools and |
44 // page contents views. Generally, page contents view is placed atop of devtools | 38 // page contents views. Generally, page contents view is placed atop of devtools |
45 // inside a common parent view, which size should be passed in |container_size|. | 39 // inside a common parent view, which size should be passed in |container_size|. |
46 // When unknown, providing empty rect as previous devtools and contents bounds | 40 // When unknown, providing empty rect as previous devtools and contents bounds |
47 // is allowed. | 41 // is allowed. |
48 void ApplyDevToolsContentsResizingStrategy( | 42 void ApplyDevToolsContentsResizingStrategy( |
49 const DevToolsContentsResizingStrategy& strategy, | 43 const DevToolsContentsResizingStrategy& strategy, |
50 const gfx::Size& container_size, | 44 const gfx::Size& container_size, |
51 const gfx::Rect& old_devtools_bounds, | |
52 const gfx::Rect& old_contents_bounds, | |
53 gfx::Rect* new_devtools_bounds, | 45 gfx::Rect* new_devtools_bounds, |
54 gfx::Rect* new_contents_bounds); | 46 gfx::Rect* new_contents_bounds); |
55 | 47 |
56 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ | 48 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ |
OLD | NEW |