devtools_contents_resizing_strategy.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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
  3. // found in the LICENSE file.
  4. #ifndef BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_
  5. #define BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_
  6. #include "base/macros.h"
  7. #include "ui/gfx/geometry/rect.h"
  8. #include "ui/gfx/geometry/size.h"
  9. // This class knows how to resize both DevTools and inspected WebContents
  10. // inside a browser window hierarchy.
  11. class DevToolsContentsResizingStrategy {
  12. public:
  13. DevToolsContentsResizingStrategy();
  14. explicit DevToolsContentsResizingStrategy(const gfx::Rect& bounds);
  15. void CopyFrom(const DevToolsContentsResizingStrategy& strategy);
  16. bool Equals(const DevToolsContentsResizingStrategy& strategy);
  17. const gfx::Rect& bounds() const { return bounds_; }
  18. bool hide_inspected_contents() const { return hide_inspected_contents_; }
  19. private:
  20. // Contents bounds. When non-empty, used instead of insets.
  21. gfx::Rect bounds_;
  22. // Determines whether inspected contents is visible.
  23. bool hide_inspected_contents_;
  24. DISALLOW_COPY_AND_ASSIGN(DevToolsContentsResizingStrategy);
  25. };
  26. // Applies contents resizing strategy, producing bounds for devtools and
  27. // page contents views. Generally, page contents view is placed atop of devtools
  28. // inside a common parent view, which size should be passed in |container_size|.
  29. // When unknown, providing empty rect as previous devtools and contents bounds
  30. // is allowed.
  31. void ApplyDevToolsContentsResizingStrategy(
  32. const DevToolsContentsResizingStrategy& strategy,
  33. const gfx::Size& container_size,
  34. gfx::Rect* new_devtools_bounds,
  35. gfx::Rect* new_contents_bounds);
  36. #endif // BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_