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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/contents_layout_manager.h"
6
7 #include "ui/views/view.h"
8
9 ContentsLayoutManager::ContentsLayoutManager(
10 views::View* devtools_view,
11 views::View* contents_view)
12 : devtools_view_(devtools_view),
13 contents_view_(contents_view),
14 host_(NULL),
15 active_top_margin_(0) {
16 }
17
18 ContentsLayoutManager::~ContentsLayoutManager() {
19 }
20
21 void ContentsLayoutManager::SetContentsViewInsets(const gfx::Insets& insets) {
22 if (insets_ == insets)
23 return;
24
25 insets_ = insets;
26 if (host_)
27 host_->InvalidateLayout();
28 }
29
30 void ContentsLayoutManager::SetActiveTopMargin(int margin) {
31 if (active_top_margin_ == margin)
32 return;
33
34 active_top_margin_ = margin;
35 if (host_)
36 host_->InvalidateLayout();
37 }
38
39 void ContentsLayoutManager::Layout(views::View* contents_container) {
40 DCHECK(host_ == contents_container);
41
42 int top = active_top_margin_;
43 int height = std::max(0, contents_container->height() - top);
44 int width = contents_container->width();
45 devtools_view_->SetBounds(0, top, width, height);
46
47 int contents_width = std::max(0, width - insets_.width());
48 int contents_height = std::max(0, height - insets_.height());
49 contents_view_->SetBounds(
50 std::min(insets_.left(), width),
51 top + std::min(insets_.top(), height),
52 contents_width,
53 contents_height);
54 }
55
56 gfx::Size ContentsLayoutManager::GetPreferredSize(views::View* host) {
57 return gfx::Size();
58 }
59
60 void ContentsLayoutManager::Installed(views::View* host) {
61 DCHECK(!host_);
62 host_ = host;
63 }
64
65 void ContentsLayoutManager::Uninstalled(views::View* host) {
66 DCHECK(host_ == host);
67 host_ = NULL;
68 }
OLDNEW
« 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