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

Unified Diff: chrome/browser/ui/views/frame/contents_layout_manager.cc

Issue 63173016: DevTools: place DevTools WebContents underneath inspected WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/contents_layout_manager.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/contents_layout_manager.cc
diff --git a/chrome/browser/ui/views/frame/contents_layout_manager.cc b/chrome/browser/ui/views/frame/contents_layout_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2d018bd2b3a09cc1d09b0a32f64309190b636948
--- /dev/null
+++ b/chrome/browser/ui/views/frame/contents_layout_manager.cc
@@ -0,0 +1,68 @@
+// Copyright 2013 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.
+
+#include "chrome/browser/ui/views/frame/contents_layout_manager.h"
+
+#include "ui/views/view.h"
+
+ContentsLayoutManager::ContentsLayoutManager(
+ views::View* devtools_view,
+ views::View* contents_view)
+ : devtools_view_(devtools_view),
+ contents_view_(contents_view),
+ host_(NULL),
+ active_top_margin_(0) {
+}
+
+ContentsLayoutManager::~ContentsLayoutManager() {
+}
+
+void ContentsLayoutManager::SetContentsViewInsets(const gfx::Insets& insets) {
+ if (insets_ == insets)
+ return;
+
+ insets_ = insets;
+ if (host_)
+ host_->InvalidateLayout();
+}
+
+void ContentsLayoutManager::SetActiveTopMargin(int margin) {
+ if (active_top_margin_ == margin)
+ return;
+
+ active_top_margin_ = margin;
+ if (host_)
+ host_->InvalidateLayout();
+}
+
+void ContentsLayoutManager::Layout(views::View* contents_container) {
+ DCHECK(host_ == contents_container);
+
+ int top = active_top_margin_;
+ int height = std::max(0, contents_container->height() - top);
+ int width = contents_container->width();
+ devtools_view_->SetBounds(0, top, width, height);
+
+ int contents_width = std::max(0, width - insets_.width());
+ int contents_height = std::max(0, height - insets_.height());
+ contents_view_->SetBounds(
+ std::min(insets_.left(), width),
+ top + std::min(insets_.top(), height),
+ contents_width,
+ contents_height);
+}
+
+gfx::Size ContentsLayoutManager::GetPreferredSize(views::View* host) {
+ return gfx::Size();
+}
+
+void ContentsLayoutManager::Installed(views::View* host) {
+ DCHECK(!host_);
+ host_ = host;
+}
+
+void ContentsLayoutManager::Uninstalled(views::View* host) {
+ DCHECK(host_ == host);
+ host_ = NULL;
+}
« no previous file with comments | « chrome/browser/ui/views/frame/contents_layout_manager.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698