1 // Copyright 2012 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.
5 #include "chrome/browser/ui/views/frame/contents_container.h"
7 ContentsContainer::ContentsContainer(views::View* active_web_view)
8 : active_web_view_(active_web_view),
9 active_top_margin_(0) {
10 AddChildView(active_web_view_);
13 ContentsContainer::~ContentsContainer() {
16 bool ContentsContainer::SetActiveTopMargin(int margin) {
17 if (active_top_margin_ == margin)
20 active_top_margin_ = margin;
21 // Make sure we layout next time around. We need this in case our bounds
27 void ContentsContainer::Layout() {
28 int content_y = active_top_margin_;
29 int content_height = std::max(0, height() - content_y);
31 active_web_view_->SetBounds(0, content_y, width(), content_height);
33 // Need to invoke views::View in case any views whose bounds didn't change
34 // still need a layout.
35 views::View::Layout();
38 const char* ContentsContainer::GetClassName() const {
39 return "ContentsContainer";