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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 int BrowserViewLayout::LayoutInfoBar(int top) { | 460 int BrowserViewLayout::LayoutInfoBar(int top) { |
461 // In immersive fullscreen, the infobar always starts near the top of the | 461 // In immersive fullscreen, the infobar always starts near the top of the |
462 // screen, just under the "light bar" rectangular stripes. | 462 // screen, just under the "light bar" rectangular stripes. |
463 if (immersive_mode_controller_->IsEnabled()) { | 463 if (immersive_mode_controller_->IsEnabled()) { |
464 top = browser_view_->y(); | 464 top = browser_view_->y(); |
465 if (!immersive_mode_controller_->ShouldHideTabIndicators()) | 465 if (!immersive_mode_controller_->ShouldHideTabIndicators()) |
466 top += TabStrip::GetImmersiveHeight(); | 466 top += TabStrip::GetImmersiveHeight(); |
467 } | 467 } |
468 // Raise the |infobar_container_| by its vertical overlap. | 468 // Raise the |infobar_container_| by its vertical overlap. |
469 infobar_container_->SetVisible(InfobarVisible()); | 469 infobar_container_->SetVisible(InfobarVisible()); |
470 int height; | 470 infobar_container_->SetBounds( |
471 int overlapped_top = top - infobar_container_->GetVerticalOverlap(&height); | 471 vertical_layout_rect_.x(), top, vertical_layout_rect_.width(), |
472 infobar_container_->SetBounds(vertical_layout_rect_.x(), | 472 infobar_container_->GetPreferredSize().height()); |
473 overlapped_top, | 473 return top + infobar_container_->height(); |
474 vertical_layout_rect_.width(), | |
475 height); | |
476 return overlapped_top + height; | |
477 } | 474 } |
478 | 475 |
479 void BrowserViewLayout::LayoutContentsContainerView(int top, int bottom) { | 476 void BrowserViewLayout::LayoutContentsContainerView(int top, int bottom) { |
480 // |contents_container_| contains web page contents and devtools. | 477 // |contents_container_| contains web page contents and devtools. |
481 // See browser_view.h for details. | 478 // See browser_view.h for details. |
482 gfx::Rect contents_container_bounds(vertical_layout_rect_.x(), | 479 gfx::Rect contents_container_bounds(vertical_layout_rect_.x(), |
483 top, | 480 top, |
484 vertical_layout_rect_.width(), | 481 vertical_layout_rect_.width(), |
485 std::max(0, bottom - top)); | 482 std::max(0, bottom - top)); |
486 contents_container_->SetBoundsRect(contents_container_bounds); | 483 contents_container_->SetBoundsRect(contents_container_bounds); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 return bottom; | 545 return bottom; |
549 } | 546 } |
550 | 547 |
551 bool BrowserViewLayout::InfobarVisible() const { | 548 bool BrowserViewLayout::InfobarVisible() const { |
552 // Cast to a views::View to access GetPreferredSize(). | 549 // Cast to a views::View to access GetPreferredSize(). |
553 views::View* infobar_container = infobar_container_; | 550 views::View* infobar_container = infobar_container_; |
554 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 551 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
555 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 552 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
556 (infobar_container->GetPreferredSize().height() != 0); | 553 (infobar_container->GetPreferredSize().height() != 0); |
557 } | 554 } |
OLD | NEW |