Chromium Code Reviews| 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(); |
| 367 infobar_container_->SetVisible(visible); | |
| 366 int height = visible ? infobar_container_->GetPreferredSize().height() : 0; | 368 int height = visible ? infobar_container_->GetPreferredSize().height() : 0; |
|
Peter Kasting
2011/03/07 20:14:30
Nit: I don't think either of these "visible ?" con
Sheridan Rawlins
2011/03/08 01:38:19
return browser()->SupportsWindowFeature(Browser::F
| |
| 367 infobar_container_->SetVisible(visible); | 369 int overlapped_top = top - |
| 368 infobar_container_->SetBounds(vertical_layout_rect_.x(), top, | 370 (visible ? infobar_container_->vertical_overlap() : 0); |
| 369 vertical_layout_rect_.width(), height); | 371 infobar_container_->SetBounds(vertical_layout_rect_.x(), |
| 370 return top + height; | 372 overlapped_top, |
| 373 vertical_layout_rect_.width(), | |
| 374 height); | |
| 375 return overlapped_top + height; | |
| 371 } | 376 } |
| 372 | 377 |
| 373 // |browser_reserved_rect| is in browser_view_ coordinates. | 378 // |browser_reserved_rect| is in browser_view_ coordinates. |
| 374 // |future_source_bounds| is in |source|'s parent coordinates. | 379 // |future_source_bounds| is in |source|'s parent coordinates. |
| 375 // |future_parent_offset| is required, since parent view is not moved yet. | 380 // |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 | 381 // Note that |future_parent_offset| is relative to browser_view_, not to |
| 377 // the parent view. | 382 // the parent view. |
| 378 void BrowserViewLayout::UpdateReservedContentsRect( | 383 void BrowserViewLayout::UpdateReservedContentsRect( |
| 379 const gfx::Rect& browser_reserved_rect, | 384 const gfx::Rect& browser_reserved_rect, |
| 380 TabContentsContainer* source, | 385 TabContentsContainer* source, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 bottom -= height; | 520 bottom -= height; |
| 516 } | 521 } |
| 517 return bottom; | 522 return bottom; |
| 518 } | 523 } |
| 519 | 524 |
| 520 bool BrowserViewLayout::InfobarVisible() const { | 525 bool BrowserViewLayout::InfobarVisible() const { |
| 521 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 526 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 522 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 527 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 523 (infobar_container_->GetPreferredSize().height() != 0); | 528 (infobar_container_->GetPreferredSize().height() != 0); |
| 524 } | 529 } |
| OLD | NEW |