| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height(); | 355 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height(); |
| 356 y -= kSeparationLineHeight + active_bookmark_bar_->GetToolbarOverlap(false); | 356 y -= kSeparationLineHeight + active_bookmark_bar_->GetToolbarOverlap(false); |
| 357 active_bookmark_bar_->SetVisible(true); | 357 active_bookmark_bar_->SetVisible(true); |
| 358 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y, | 358 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y, |
| 359 vertical_layout_rect_.width(), | 359 vertical_layout_rect_.width(), |
| 360 bookmark_bar_height); | 360 bookmark_bar_height); |
| 361 return y + bookmark_bar_height; | 361 return y + bookmark_bar_height; |
| 362 } | 362 } |
| 363 | 363 |
| 364 int BrowserViewLayout::LayoutInfoBar(int top) { | 364 int BrowserViewLayout::LayoutInfoBar(int top) { |
| 365 // Raise the |infobar_container_| by its overlapping tab_height. |
| 365 bool visible = InfobarVisible(); | 366 bool visible = InfobarVisible(); |
| 366 int height = visible ? infobar_container_->GetPreferredSize().height() : 0; | |
| 367 infobar_container_->SetVisible(visible); | 367 infobar_container_->SetVisible(visible); |
| 368 infobar_container_->SetBounds(vertical_layout_rect_.x(), top, | 368 int height = infobar_container_->GetPreferredSize().height(); |
| 369 vertical_layout_rect_.width(), height); | 369 DCHECK(visible || !height) << "Invisible InfoBarContainer has height."; |
| 370 return top + height; | 370 int overlapped_top = top - |
| 371 static_cast<InfoBarContainer*>(infobar_container_)->VerticalOverlap(); |
| 372 infobar_container_->SetBounds(vertical_layout_rect_.x(), |
| 373 overlapped_top, |
| 374 vertical_layout_rect_.width(), |
| 375 height); |
| 376 return overlapped_top + height; |
| 371 } | 377 } |
| 372 | 378 |
| 373 // |browser_reserved_rect| is in browser_view_ coordinates. | 379 // |browser_reserved_rect| is in browser_view_ coordinates. |
| 374 // |future_source_bounds| is in |source|'s parent coordinates. | 380 // |future_source_bounds| is in |source|'s parent coordinates. |
| 375 // |future_parent_offset| is required, since parent view is not moved yet. | 381 // |future_parent_offset| is required, since parent view is not moved yet. |
| 376 // Note that |future_parent_offset| is relative to browser_view_, not to | 382 // Note that |future_parent_offset| is relative to browser_view_, not to |
| 377 // the parent view. | 383 // the parent view. |
| 378 void BrowserViewLayout::UpdateReservedContentsRect( | 384 void BrowserViewLayout::UpdateReservedContentsRect( |
| 379 const gfx::Rect& browser_reserved_rect, | 385 const gfx::Rect& browser_reserved_rect, |
| 380 TabContentsContainer* source, | 386 TabContentsContainer* source, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 bottom -= height; | 521 bottom -= height; |
| 516 } | 522 } |
| 517 return bottom; | 523 return bottom; |
| 518 } | 524 } |
| 519 | 525 |
| 520 bool BrowserViewLayout::InfobarVisible() const { | 526 bool BrowserViewLayout::InfobarVisible() const { |
| 521 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 527 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 522 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 528 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 523 (infobar_container_->GetPreferredSize().height() != 0); | 529 (infobar_container_->GetPreferredSize().height() != 0); |
| 524 } | 530 } |
| OLD | NEW |