| Index: chrome/browser/ui/views/frame/devtools_container.cc
|
| diff --git a/chrome/browser/ui/views/frame/devtools_container.cc b/chrome/browser/ui/views/frame/devtools_container.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5947daa5b3c95cf5d6fb03550cb8f65f7b14d12e
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/frame/devtools_container.cc
|
| @@ -0,0 +1,47 @@
|
| +// 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/devtools_container.h"
|
| +
|
| +DevToolsContainer::DevToolsContainer(
|
| + views::View* contents_view, views::View* devtools_view)
|
| + : contents_view_(contents_view),
|
| + devtools_view_(devtools_view) {
|
| + AddChildView(devtools_view_);
|
| + AddChildView(contents_view_);
|
| +}
|
| +
|
| +DevToolsContainer::~DevToolsContainer() {
|
| +}
|
| +
|
| +void DevToolsContainer::SetContentsViewOffsets(
|
| + const gfx::Size& top_left, const gfx::Size& bottom_right) {
|
| + if (top_left_ != top_left || bottom_right_ != bottom_right) {
|
| + top_left_ = top_left;
|
| + bottom_right_ = bottom_right;
|
| + Layout();
|
| + }
|
| +}
|
| +
|
| +void DevToolsContainer::Layout() {
|
| + devtools_view_->SetBounds(0, 0, 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()),
|
| + std::min(top_left_.height(), height()),
|
| + contents_width,
|
| + contents_height);
|
| +
|
| + // Need to invoke views::View in case any views whose bounds didn't change
|
| + // still need a layout.
|
| + views::View::Layout();
|
| +}
|
| +
|
| +const char* DevToolsContainer::GetClassName() const {
|
| + return "DevToolsContainer";
|
| +}
|
|
|