| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h" | 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sidebar/sidebar_manager.h" | 7 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 8 #include "chrome/browser/ui/find_bar/find_bar.h" | 8 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 10 #include "chrome/browser/ui/view_ids.h" | 10 #include "chrome/browser/ui/view_ids.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { | 242 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { |
| 243 switch (view->GetID()) { | 243 switch (view->GetID()) { |
| 244 case VIEW_ID_BOOKMARK_BAR: | 244 case VIEW_ID_BOOKMARK_BAR: |
| 245 active_bookmark_bar_ = NULL; | 245 active_bookmark_bar_ = NULL; |
| 246 break; | 246 break; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 void BrowserViewLayout::Layout(views::View* host) { | 250 void BrowserViewLayout::Layout(views::View* host) { |
| 251 vertical_layout_rect_ = browser_view_->GetContentsBounds(); | 251 vertical_layout_rect_ = browser_view_->GetLocalBounds(); |
| 252 int top = LayoutTabStrip(); | 252 int top = LayoutTabStrip(); |
| 253 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { | 253 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { |
| 254 tabstrip_->SetBackgroundOffset(gfx::Point( | 254 tabstrip_->SetBackgroundOffset(gfx::Point( |
| 255 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(), | 255 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(), |
| 256 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false))); | 256 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false))); |
| 257 } | 257 } |
| 258 top = LayoutToolbar(top); | 258 top = LayoutToolbar(top); |
| 259 top = LayoutBookmarkAndInfoBars(top); | 259 top = LayoutBookmarkAndInfoBars(top); |
| 260 int bottom = LayoutDownloadShelf(browser_view_->height()); | 260 int bottom = LayoutDownloadShelf(browser_view_->height()); |
| 261 int active_top_margin = GetTopMarginForActiveContent(); | 261 int active_top_margin = GetTopMarginForActiveContent(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // Layout resize corner, sidebar mini tabs and calculate reserved contents | 441 // Layout resize corner, sidebar mini tabs and calculate reserved contents |
| 442 // rects here as all contents view bounds are already determined, but not yet | 442 // rects here as all contents view bounds are already determined, but not yet |
| 443 // set at this point, so contents will be laid out once at most. | 443 // set at this point, so contents will be laid out once at most. |
| 444 // TODO(alekseys): layout sidebar minitabs and adjust reserved rect | 444 // TODO(alekseys): layout sidebar minitabs and adjust reserved rect |
| 445 // accordingly. | 445 // accordingly. |
| 446 gfx::Rect browser_reserved_rect; | 446 gfx::Rect browser_reserved_rect; |
| 447 if (!browser_view_->frame_->GetWindow()->IsMaximized() && | 447 if (!browser_view_->frame_->GetWindow()->IsMaximized() && |
| 448 !browser_view_->frame_->GetWindow()->IsFullscreen()) { | 448 !browser_view_->frame_->GetWindow()->IsFullscreen()) { |
| 449 gfx::Size resize_corner_size = browser_view_->GetResizeCornerSize(); | 449 gfx::Size resize_corner_size = browser_view_->GetResizeCornerSize(); |
| 450 if (!resize_corner_size.IsEmpty()) { | 450 if (!resize_corner_size.IsEmpty()) { |
| 451 gfx::Rect bounds = browser_view_->GetLocalBounds(); | 451 gfx::Rect bounds = browser_view_->GetContentsBounds(); |
| 452 gfx::Point resize_corner_origin( | 452 gfx::Point resize_corner_origin( |
| 453 bounds.right() - resize_corner_size.width(), | 453 bounds.right() - resize_corner_size.width(), |
| 454 bounds.bottom() - resize_corner_size.height()); | 454 bounds.bottom() - resize_corner_size.height()); |
| 455 browser_reserved_rect = | 455 browser_reserved_rect = |
| 456 gfx::Rect(resize_corner_origin, resize_corner_size); | 456 gfx::Rect(resize_corner_origin, resize_corner_size); |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 UpdateReservedContentsRect(browser_reserved_rect, | 460 UpdateReservedContentsRect(browser_reserved_rect, |
| 461 browser_view_->contents_container_, | 461 browser_view_->contents_container_, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 bottom -= height; | 515 bottom -= height; |
| 516 } | 516 } |
| 517 return bottom; | 517 return bottom; |
| 518 } | 518 } |
| 519 | 519 |
| 520 bool BrowserViewLayout::InfobarVisible() const { | 520 bool BrowserViewLayout::InfobarVisible() const { |
| 521 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 521 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 522 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 522 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 523 (infobar_container_->GetPreferredSize().height() != 0); | 523 (infobar_container_->GetPreferredSize().height() != 0); |
| 524 } | 524 } |
| OLD | NEW |