| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 !bookmark_bar_->IsDetached()) { | 527 !bookmark_bar_->IsDetached()) { |
| 528 return 0; | 528 return 0; |
| 529 } | 529 } |
| 530 | 530 |
| 531 // Offset for the detached bookmark bar. | 531 // Offset for the detached bookmark bar. |
| 532 return bookmark_bar_->height() - | 532 return bookmark_bar_->height() - |
| 533 views::NonClientFrameView::kClientEdgeThickness; | 533 views::NonClientFrameView::kClientEdgeThickness; |
| 534 } | 534 } |
| 535 | 535 |
| 536 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { | 536 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { |
| 537 if (delegate_->DownloadShelfNeedsLayout()) { | 537 if (!delegate_->DownloadShelfNeedsLayout()) |
| 538 bool visible = browser()->SupportsWindowFeature( | 538 return bottom; |
| 539 Browser::FEATURE_DOWNLOADSHELF); | 539 |
| 540 DCHECK(download_shelf_); | 540 DCHECK(download_shelf_); |
| 541 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; | 541 int height = download_shelf_->GetPreferredSize().height(); |
| 542 download_shelf_->SetVisible(visible); | 542 download_shelf_->SetVisible(true); |
| 543 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, | 543 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, |
| 544 vertical_layout_rect_.width(), height); | 544 vertical_layout_rect_.width(), height); |
| 545 download_shelf_->Layout(); | 545 download_shelf_->Layout(); |
| 546 bottom -= height; | 546 return bottom - height; |
| 547 } | |
| 548 return bottom; | |
| 549 } | 547 } |
| 550 | 548 |
| 551 bool BrowserViewLayout::InfobarVisible() const { | 549 bool BrowserViewLayout::InfobarVisible() const { |
| 552 // Cast to a views::View to access GetPreferredSize(). | 550 // Cast to a views::View to access GetPreferredSize(). |
| 553 views::View* infobar_container = infobar_container_; | 551 views::View* infobar_container = infobar_container_; |
| 554 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 552 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 555 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 553 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 556 (infobar_container->GetPreferredSize().height() != 0); | 554 (infobar_container->GetPreferredSize().height() != 0); |
| 557 } | 555 } |
| OLD | NEW |