Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ | |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "ui/gfx/insets.h" | |
| 10 #include "ui/gfx/rect.h" | |
| 11 #include "ui/gfx/size.h" | |
| 12 | |
| 13 // This class knows how to resize both DevTools and inspected WebContents | |
| 14 // inside a browser window hierarchy. It only holds data, and can be copied | |
| 15 // around freely. | |
| 16 class DevToolsContentsResizingStrategy { | |
| 17 public: | |
| 18 DevToolsContentsResizingStrategy(); | |
| 19 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.
| |
| 20 | |
| 21 const gfx::Insets& insets() const { return insets_; } | |
| 22 const gfx::Size& min_size() const { return min_size_; } | |
| 23 | |
| 24 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.
| |
| 25 const gfx::Size& container_size, | |
| 26 const gfx::Rect& old_devtools_bounds, | |
| 27 const gfx::Rect& old_contents_bounds, | |
| 28 gfx::Rect* new_devtools_bounds, | |
| 29 gfx::Rect* new_contents_bounds) const; | |
| 30 | |
| 31 private: | |
| 32 | |
|
sky
2014/02/03 22:17:29
no newline.
dgozman
2014/02/04 13:08:48
Done.
| |
| 33 // Insets of contents inside DevTools. | |
| 34 gfx::Insets insets_; | |
| 35 | |
| 36 // Minimum size of contents. | |
| 37 gfx::Size min_size_; | |
| 38 }; | |
|
sky
2014/02/03 22:17:29
DISALLOW_C... If you want to allow copy, document
dgozman
2014/02/04 13:08:48
Done.
| |
| 39 | |
| 40 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.
| |
| 41 const DevToolsContentsResizingStrategy& rhs) { | |
| 42 return lhs.insets() == rhs.insets() && lhs.min_size() == rhs.min_size(); | |
| 43 } | |
| 44 | |
| 45 inline bool operator!=(const DevToolsContentsResizingStrategy& lhs, | |
| 46 const DevToolsContentsResizingStrategy& rhs) { | |
| 47 return !(lhs == rhs); | |
| 48 } | |
| 49 | |
| 50 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ | |
| OLD | NEW |