Chromium Code Reviews| OLD | NEW |
|---|---|
| (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, 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.
| |
| 11 : devtools_view_(devtools_view), | |
| 12 contents_view_(contents_view), | |
| 13 active_top_margin_(0) { | |
| 14 } | |
| 15 | |
| 16 ContentsLayoutManager::~ContentsLayoutManager() { | |
| 17 } | |
| 18 | |
| 19 bool ContentsLayoutManager::SetContentsViewOffsets( | |
| 20 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.
| |
| 21 if (top_left_ != top_left || bottom_right_ != bottom_right) { | |
| 22 top_left_ = top_left; | |
| 23 bottom_right_ = bottom_right; | |
| 24 return true; | |
| 25 } | |
| 26 return false; | |
| 27 } | |
| 28 | |
| 29 bool ContentsLayoutManager::SetActiveTopMargin(int margin) { | |
| 30 if (active_top_margin_ != margin) { | |
| 31 active_top_margin_ = margin; | |
| 32 return true; | |
| 33 } | |
| 34 return false; | |
| 35 } | |
| 36 | |
| 37 void ContentsLayoutManager::Layout(views::View* contents_container) { | |
| 38 int top = active_top_margin_; | |
| 39 int height = std::max(0, contents_container->height() - top); | |
| 40 int width = contents_container->width(); | |
| 41 devtools_view_->SetBounds(0, top, width, height); | |
| 42 | |
| 43 int contents_width = std::max(0, | |
| 44 width - top_left_.width() - bottom_right_.width()); | |
| 45 int contents_height = std::max(0, | |
| 46 height - top_left_.height() - bottom_right_.height()); | |
| 47 contents_view_->SetBounds( | |
| 48 std::min(top_left_.width(), width), | |
| 49 top + std::min(top_left_.height(), height), | |
| 50 contents_width, | |
| 51 contents_height); | |
| 52 } | |
| 53 | |
| 54 gfx::Size ContentsLayoutManager::GetPreferredSize(views::View* host) { | |
| 55 return gfx::Size(); | |
| 56 } | |
| OLD | NEW |