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

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: Views fixes 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
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..e47a96a687a51a73ee821a3df17a8cc40c9e1168
--- /dev/null
+++ b/chrome/browser/ui/views/frame/contents_layout_manager.cc
@@ -0,0 +1,56 @@
+// 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)
sky 2013/12/06 17:25:44 nit: when you wrap, each param on its own line.
dgozman 2013/12/09 13:19:18 Done.
+ : devtools_view_(devtools_view),
+ contents_view_(contents_view),
+ active_top_margin_(0) {
+}
+
+ContentsLayoutManager::~ContentsLayoutManager() {
+}
+
+bool ContentsLayoutManager::SetContentsViewOffsets(
+ const gfx::Size& top_left, const gfx::Size& bottom_right) {
sky 2013/12/06 17:25:44 nit: when you wrap, each param on its own line.
dgozman 2013/12/09 13:19:18 Done.
+ if (top_left_ != top_left || bottom_right_ != bottom_right) {
+ top_left_ = top_left;
+ bottom_right_ = bottom_right;
+ return true;
+ }
+ return false;
+}
+
+bool ContentsLayoutManager::SetActiveTopMargin(int margin) {
+ if (active_top_margin_ != margin) {
+ active_top_margin_ = margin;
+ return true;
+ }
+ return false;
+}
+
+void ContentsLayoutManager::Layout(views::View* 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 - top_left_.width() - bottom_right_.width());
+ int contents_height = std::max(0,
+ height - top_left_.height() - bottom_right_.height());
+ contents_view_->SetBounds(
+ std::min(top_left_.width(), width),
+ top + std::min(top_left_.height(), height),
+ contents_width,
+ contents_height);
+}
+
+gfx::Size ContentsLayoutManager::GetPreferredSize(views::View* host) {
+ return gfx::Size();
+}

Powered by Google App Engine
This is Rietveld 408576698