| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 switch (view->GetID()) { | 215 switch (view->GetID()) { |
| 216 case VIEW_ID_CONTENTS_SPLIT: { | 216 case VIEW_ID_CONTENTS_SPLIT: { |
| 217 contents_split_ = static_cast<views::SingleSplitView*>(view); | 217 contents_split_ = static_cast<views::SingleSplitView*>(view); |
| 218 // We're installed as the LayoutManager before BrowserView creates the | 218 // We're installed as the LayoutManager before BrowserView creates the |
| 219 // contents, so we have to set contents_container_ here rather than in | 219 // contents, so we have to set contents_container_ here rather than in |
| 220 // Installed. | 220 // Installed. |
| 221 contents_container_ = browser_view_->contents_; | 221 contents_container_ = browser_view_->contents_; |
| 222 break; | 222 break; |
| 223 } | 223 } |
| 224 case VIEW_ID_INFO_BAR_CONTAINER: | 224 case VIEW_ID_INFO_BAR_CONTAINER: |
| 225 infobar_container_ = view; | 225 infobar_container_ = static_cast<InfoBarContainer*>(view); |
| 226 break; | 226 break; |
| 227 case VIEW_ID_DOWNLOAD_SHELF: | 227 case VIEW_ID_DOWNLOAD_SHELF: |
| 228 download_shelf_ = static_cast<DownloadShelfView*>(view); | 228 download_shelf_ = static_cast<DownloadShelfView*>(view); |
| 229 break; | 229 break; |
| 230 case VIEW_ID_BOOKMARK_BAR: | 230 case VIEW_ID_BOOKMARK_BAR: |
| 231 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); | 231 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); |
| 232 break; | 232 break; |
| 233 case VIEW_ID_TOOLBAR: | 233 case VIEW_ID_TOOLBAR: |
| 234 toolbar_ = static_cast<ToolbarView*>(view); | 234 toolbar_ = static_cast<ToolbarView*>(view); |
| 235 break; | 235 break; |
| (...skipping 119 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 InfoBarContainer::Heights heights = visible ? |
| 368 infobar_container_->GetHeights() : InfoBarContainer::Heights(0, 0); |
| 367 infobar_container_->SetVisible(visible); | 369 infobar_container_->SetVisible(visible); |
| 368 infobar_container_->SetBounds(vertical_layout_rect_.x(), top, | 370 infobar_container_->SetBounds(vertical_layout_rect_.x(), |
| 369 vertical_layout_rect_.width(), height); | 371 top - heights.tab_height(), |
| 370 return top + height; | 372 vertical_layout_rect_.width(), |
| 373 heights.height()); |
| 374 return top + heights.bar_height(); |
| 371 } | 375 } |
| 372 | 376 |
| 373 // |browser_reserved_rect| is in browser_view_ coordinates. | 377 // |browser_reserved_rect| is in browser_view_ coordinates. |
| 374 // |future_source_bounds| is in |source|'s parent coordinates. | 378 // |future_source_bounds| is in |source|'s parent coordinates. |
| 375 // |future_parent_offset| is required, since parent view is not moved yet. | 379 // |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 | 380 // Note that |future_parent_offset| is relative to browser_view_, not to |
| 377 // the parent view. | 381 // the parent view. |
| 378 void BrowserViewLayout::UpdateReservedContentsRect( | 382 void BrowserViewLayout::UpdateReservedContentsRect( |
| 379 const gfx::Rect& browser_reserved_rect, | 383 const gfx::Rect& browser_reserved_rect, |
| 380 TabContentsContainer* source, | 384 TabContentsContainer* source, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 vertical_layout_rect_.width(), height); | 517 vertical_layout_rect_.width(), height); |
| 514 download_shelf_->Layout(); | 518 download_shelf_->Layout(); |
| 515 bottom -= height; | 519 bottom -= height; |
| 516 } | 520 } |
| 517 return bottom; | 521 return bottom; |
| 518 } | 522 } |
| 519 | 523 |
| 520 bool BrowserViewLayout::InfobarVisible() const { | 524 bool BrowserViewLayout::InfobarVisible() const { |
| 521 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 525 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 522 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 526 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 523 (infobar_container_->GetPreferredSize().height() != 0); | 527 (infobar_container_->GetHeights().height() != 0); |
| 524 } | 528 } |
| OLD | NEW |