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

Side by Side Diff: chrome/browser/ui/views/frame/devtools_container.cc

Issue 63173016: DevTools: place DevTools WebContents underneath inspected WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 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 #include "chrome/browser/ui/views/frame/devtools_container.h"
6
7 DevToolsContainer::DevToolsContainer(
8 views::View* contents_view, views::View* devtools_view)
9 : contents_view_(contents_view),
10 devtools_view_(devtools_view) {
11 AddChildView(devtools_view_);
12 AddChildView(contents_view_);
13 }
14
15 DevToolsContainer::~DevToolsContainer() {
16 }
17
18 void DevToolsContainer::SetContentsViewOffsets(
19 const gfx::Size& top_left, const gfx::Size& bottom_right) {
20 if (top_left_ != top_left || bottom_right_ != bottom_right) {
21 top_left_ = top_left;
22 bottom_right_ = bottom_right;
23 Layout();
24 }
25 }
26
27 void DevToolsContainer::Layout() {
28 devtools_view_->SetBounds(0, 0, width(), height());
29
30 int contents_width = std::max(0,
31 width() - top_left_.width() - bottom_right_.width());
32 int contents_height = std::max(0,
33 height() - top_left_.height() - bottom_right_.height());
34 contents_view_->SetBounds(
35 std::min(top_left_.width(), width()),
36 std::min(top_left_.height(), height()),
37 contents_width,
38 contents_height);
39
40 // Need to invoke views::View in case any views whose bounds didn't change
41 // still need a layout.
42 views::View::Layout();
43 }
44
45 const char* DevToolsContainer::GetClassName() const {
46 return "DevToolsContainer";
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698