Index: chrome/browser/devtools/devtools_contents_resizing_strategy.h |
diff --git a/chrome/browser/devtools/devtools_contents_resizing_strategy.h b/chrome/browser/devtools/devtools_contents_resizing_strategy.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66a129eb1f21b4e186741509782f719a3da17866 |
--- /dev/null |
+++ b/chrome/browser/devtools/devtools_contents_resizing_strategy.h |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ |
+#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ |
+ |
+#include "base/basictypes.h" |
+#include "ui/gfx/insets.h" |
+#include "ui/gfx/rect.h" |
+#include "ui/gfx/size.h" |
+ |
+// This class knows how to resize both DevTools and inspected WebContents |
+// inside a browser window hierarchy. It only holds data, and can be copied |
+// around freely. |
+class DevToolsContentsResizingStrategy { |
+ public: |
+ DevToolsContentsResizingStrategy(); |
+ DevToolsContentsResizingStrategy(gfx::Insets insets, gfx::Size min_size); |
sky
2014/02/03 22:17:29
const refs on both of these.
dgozman
2014/02/04 13:08:48
Done.
|
+ |
+ const gfx::Insets& insets() const { return insets_; } |
+ const gfx::Size& min_size() const { return min_size_; } |
+ |
+ void Apply( |
sky
2014/02/03 22:17:29
Feels like this should not be part of this class,
dgozman
2014/02/04 13:08:48
Done.
|
+ const gfx::Size& container_size, |
+ const gfx::Rect& old_devtools_bounds, |
+ const gfx::Rect& old_contents_bounds, |
+ gfx::Rect* new_devtools_bounds, |
+ gfx::Rect* new_contents_bounds) const; |
+ |
+ private: |
+ |
sky
2014/02/03 22:17:29
no newline.
dgozman
2014/02/04 13:08:48
Done.
|
+ // Insets of contents inside DevTools. |
+ gfx::Insets insets_; |
+ |
+ // Minimum size of contents. |
+ gfx::Size min_size_; |
+}; |
sky
2014/02/03 22:17:29
DISALLOW_C... If you want to allow copy, document
dgozman
2014/02/04 13:08:48
Done.
|
+ |
+inline bool operator==(const DevToolsContentsResizingStrategy& lhs, |
sky
2014/02/03 22:17:29
See style guide, in general prefer an Equals() met
dgozman
2014/02/04 13:08:48
Done.
|
+ const DevToolsContentsResizingStrategy& rhs) { |
+ return lhs.insets() == rhs.insets() && lhs.min_size() == rhs.min_size(); |
+} |
+ |
+inline bool operator!=(const DevToolsContentsResizingStrategy& lhs, |
+ const DevToolsContentsResizingStrategy& rhs) { |
+ return !(lhs == rhs); |
+} |
+ |
+#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ |