| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 contents_split_bounds, &sidebar_split_bounds, &devtools_bounds); | 539 contents_split_bounds, &sidebar_split_bounds, &devtools_bounds); |
| 540 gfx::Point contents_split_offset( | 540 gfx::Point contents_split_offset( |
| 541 contents_split_bounds.x() - contents_split_->bounds().x(), | 541 contents_split_bounds.x() - contents_split_->bounds().x(), |
| 542 contents_split_bounds.y() - contents_split_->bounds().y()); | 542 contents_split_bounds.y() - contents_split_->bounds().y()); |
| 543 gfx::Point sidebar_split_offset(contents_split_offset); | 543 gfx::Point sidebar_split_offset(contents_split_offset); |
| 544 sidebar_split_offset.Offset(sidebar_split_bounds.x(), | 544 sidebar_split_offset.Offset(sidebar_split_bounds.x(), |
| 545 sidebar_split_bounds.y()); | 545 sidebar_split_bounds.y()); |
| 546 | 546 |
| 547 views::SingleSplitView* sidebar_split = browser_view_->sidebar_split_; | 547 views::SingleSplitView* sidebar_split = browser_view_->sidebar_split_; |
| 548 if (sidebar_split) { | 548 if (sidebar_split) { |
| 549 DCHECK(sidebar_split == contents_split_->GetChildViewAt(0)); | 549 DCHECK(sidebar_split == contents_split_->child_at(0)); |
| 550 sidebar_split->CalculateChildrenBounds( | 550 sidebar_split->CalculateChildrenBounds( |
| 551 sidebar_split_bounds, &contents_bounds, &sidebar_bounds); | 551 sidebar_split_bounds, &contents_bounds, &sidebar_bounds); |
| 552 } else { | 552 } else { |
| 553 contents_bounds = sidebar_split_bounds; | 553 contents_bounds = sidebar_split_bounds; |
| 554 } | 554 } |
| 555 | 555 |
| 556 // Layout resize corner, sidebar mini tabs and calculate reserved contents | 556 // Layout resize corner, sidebar mini tabs and calculate reserved contents |
| 557 // rects here as all contents view bounds are already determined, but not yet | 557 // rects here as all contents view bounds are already determined, but not yet |
| 558 // set at this point, so contents will be laid out once at most. | 558 // set at this point, so contents will be laid out once at most. |
| 559 // TODO(alekseys): layout sidebar minitabs and adjust reserved rect | 559 // TODO(alekseys): layout sidebar minitabs and adjust reserved rect |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 if (sidebar_split) | 592 if (sidebar_split) |
| 593 sidebar_split->SetBoundsRect(sidebar_split_bounds); | 593 sidebar_split->SetBoundsRect(sidebar_split_bounds); |
| 594 } | 594 } |
| 595 | 595 |
| 596 int BrowserViewLayout::GetTopMarginForActiveContent() { | 596 int BrowserViewLayout::GetTopMarginForActiveContent() { |
| 597 if (!active_bookmark_bar_ || !browser_view_->IsBookmarkBarVisible() || | 597 if (!active_bookmark_bar_ || !browser_view_->IsBookmarkBarVisible() || |
| 598 !active_bookmark_bar_->IsDetached()) { | 598 !active_bookmark_bar_->IsDetached()) { |
| 599 return 0; | 599 return 0; |
| 600 } | 600 } |
| 601 | 601 |
| 602 if (contents_split_->GetChildViewAt(1) && | 602 if (contents_split_->child_at(1) && |
| 603 contents_split_->GetChildViewAt(1)->IsVisible()) | 603 contents_split_->child_at(1)->IsVisible()) |
| 604 return 0; | 604 return 0; |
| 605 | 605 |
| 606 if (SidebarManager::IsSidebarAllowed()) { | 606 if (SidebarManager::IsSidebarAllowed()) { |
| 607 views::View* sidebar_split = contents_split_->GetChildViewAt(0); | 607 views::View* sidebar_split = contents_split_->child_at(0); |
| 608 if (sidebar_split->GetChildViewAt(1) && | 608 if (sidebar_split->child_at(1) && |
| 609 sidebar_split->GetChildViewAt(1)->IsVisible()) | 609 sidebar_split->child_at(1)->IsVisible()) |
| 610 return 0; | 610 return 0; |
| 611 } | 611 } |
| 612 | 612 |
| 613 // Adjust for separator. | 613 // Adjust for separator. |
| 614 return active_bookmark_bar_->height() - | 614 return active_bookmark_bar_->height() - |
| 615 views::NonClientFrameView::kClientEdgeThickness; | 615 views::NonClientFrameView::kClientEdgeThickness; |
| 616 } | 616 } |
| 617 | 617 |
| 618 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { | 618 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { |
| 619 #if !defined(OS_CHROMEOS) | 619 #if !defined(OS_CHROMEOS) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 634 } | 634 } |
| 635 #endif | 635 #endif |
| 636 return bottom; | 636 return bottom; |
| 637 } | 637 } |
| 638 | 638 |
| 639 bool BrowserViewLayout::InfobarVisible() const { | 639 bool BrowserViewLayout::InfobarVisible() const { |
| 640 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 640 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 641 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 641 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 642 (infobar_container_->GetPreferredSize().height() != 0); | 642 (infobar_container_->GetPreferredSize().height() != 0); |
| 643 } | 643 } |
| OLD | NEW |