| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 int BrowserViewLayout::GetContentsOffsetForBookmarkBar() { | 505 int BrowserViewLayout::GetContentsOffsetForBookmarkBar() { |
| 506 // If the bookmark bar is hidden or attached to the omnibox the web contents | 506 // If the bookmark bar is hidden or attached to the omnibox the web contents |
| 507 // will appear directly underneath it and does not need an offset. | 507 // will appear directly underneath it and does not need an offset. |
| 508 if (!bookmark_bar_ || | 508 if (!bookmark_bar_ || |
| 509 !delegate_->IsBookmarkBarVisible() || | 509 !delegate_->IsBookmarkBarVisible() || |
| 510 !bookmark_bar_->IsDetached()) { | 510 !bookmark_bar_->IsDetached()) { |
| 511 return 0; | 511 return 0; |
| 512 } | 512 } |
| 513 | 513 |
| 514 // Offset for the detached bookmark bar. | 514 // Offset for the detached bookmark bar. |
| 515 return bookmark_bar_->height() - | 515 return bookmark_bar_->height(); |
| 516 views::NonClientFrameView::kClientEdgeThickness; | |
| 517 } | 516 } |
| 518 | 517 |
| 519 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { | 518 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { |
| 520 if (delegate_->DownloadShelfNeedsLayout()) { | 519 if (delegate_->DownloadShelfNeedsLayout()) { |
| 521 bool visible = browser()->SupportsWindowFeature( | 520 bool visible = browser()->SupportsWindowFeature( |
| 522 Browser::FEATURE_DOWNLOADSHELF); | 521 Browser::FEATURE_DOWNLOADSHELF); |
| 523 DCHECK(download_shelf_); | 522 DCHECK(download_shelf_); |
| 524 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; | 523 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; |
| 525 download_shelf_->SetVisible(visible); | 524 download_shelf_->SetVisible(visible); |
| 526 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, | 525 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, |
| 527 vertical_layout_rect_.width(), height); | 526 vertical_layout_rect_.width(), height); |
| 528 download_shelf_->Layout(); | 527 download_shelf_->Layout(); |
| 529 bottom -= height; | 528 bottom -= height; |
| 530 } | 529 } |
| 531 return bottom; | 530 return bottom; |
| 532 } | 531 } |
| 533 | 532 |
| 534 bool BrowserViewLayout::InfobarVisible() const { | 533 bool BrowserViewLayout::InfobarVisible() const { |
| 535 // Cast to a views::View to access GetPreferredSize(). | 534 // Cast to a views::View to access GetPreferredSize(). |
| 536 views::View* infobar_container = infobar_container_; | 535 views::View* infobar_container = infobar_container_; |
| 537 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 536 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 538 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 537 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 539 (infobar_container->GetPreferredSize().height() != 0); | 538 (infobar_container->GetPreferredSize().height() != 0); |
| 540 } | 539 } |
| OLD | NEW |