| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/find_bar/find_bar.h" | 7 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 8 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 8 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
| 10 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 10 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 11 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_frame.h" | 12 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 13 #include "chrome/browser/ui/views/frame/contents_container.h" | 14 #include "chrome/browser/ui/views/frame/contents_container.h" |
| 14 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 15 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 15 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 16 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
| 16 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" | 17 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" |
| 17 #include "chrome/browser/ui/views/toolbar_view.h" | 18 #include "chrome/browser/ui/views/toolbar_view.h" |
| 18 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
| 19 #include "ui/gfx/point.h" | 20 #include "ui/gfx/point.h" |
| 20 #include "ui/gfx/scrollbar_size.h" | 21 #include "ui/gfx/scrollbar_size.h" |
| 21 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
| 22 #include "ui/views/controls/single_split_view.h" | 23 #include "ui/views/controls/single_split_view.h" |
| 23 | 24 |
| 24 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | |
| 25 #include "chrome/browser/ui/views/download/download_shelf_view.h" | |
| 26 #endif | |
| 27 | 25 |
| 28 namespace { | 26 namespace { |
| 29 | 27 |
| 30 // The visible height of the shadow above the tabs. Clicks in this area are | 28 // The visible height of the shadow above the tabs. Clicks in this area are |
| 31 // treated as clicks to the frame, rather than clicks to the tab. | 29 // treated as clicks to the frame, rather than clicks to the tab. |
| 32 const int kTabShadowSize = 2; | 30 const int kTabShadowSize = 2; |
| 33 // The vertical overlap between the TabStrip and the Toolbar. | 31 // The vertical overlap between the TabStrip and the Toolbar. |
| 34 const int kToolbarTabStripVerticalOverlap = 3; | 32 const int kToolbarTabStripVerticalOverlap = 3; |
| 35 // The number of pixels the bookmark bar should overlap the spacer by if the | 33 // The number of pixels the bookmark bar should overlap the spacer by if the |
| 36 // spacer is visible. | 34 // spacer is visible. |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 427 |
| 430 if (contents_split_->child_at(1) && contents_split_->child_at(1)->visible()) | 428 if (contents_split_->child_at(1) && contents_split_->child_at(1)->visible()) |
| 431 return 0; | 429 return 0; |
| 432 | 430 |
| 433 // Adjust for separator. | 431 // Adjust for separator. |
| 434 return active_bookmark_bar_->height() - | 432 return active_bookmark_bar_->height() - |
| 435 views::NonClientFrameView::kClientEdgeThickness; | 433 views::NonClientFrameView::kClientEdgeThickness; |
| 436 } | 434 } |
| 437 | 435 |
| 438 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { | 436 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { |
| 439 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | |
| 440 // Re-layout the shelf either if it is visible or if its close animation | 437 // Re-layout the shelf either if it is visible or if its close animation |
| 441 // is currently running. ChromiumOS uses ActiveDownloadsUI instead of | 438 // is currently running. |
| 442 // DownloadShelf. | |
| 443 if (browser_view_->IsDownloadShelfVisible() || | 439 if (browser_view_->IsDownloadShelfVisible() || |
| 444 (download_shelf_ && download_shelf_->IsClosing())) { | 440 (download_shelf_ && download_shelf_->IsClosing())) { |
| 445 bool visible = browser()->SupportsWindowFeature( | 441 bool visible = browser()->SupportsWindowFeature( |
| 446 Browser::FEATURE_DOWNLOADSHELF); | 442 Browser::FEATURE_DOWNLOADSHELF); |
| 447 DCHECK(download_shelf_); | 443 DCHECK(download_shelf_); |
| 448 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; | 444 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; |
| 449 download_shelf_->SetVisible(visible); | 445 download_shelf_->SetVisible(visible); |
| 450 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, | 446 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, |
| 451 vertical_layout_rect_.width(), height); | 447 vertical_layout_rect_.width(), height); |
| 452 download_shelf_->Layout(); | 448 download_shelf_->Layout(); |
| 453 bottom -= height; | 449 bottom -= height; |
| 454 } | 450 } |
| 455 #endif | |
| 456 return bottom; | 451 return bottom; |
| 457 } | 452 } |
| 458 | 453 |
| 459 bool BrowserViewLayout::InfobarVisible() const { | 454 bool BrowserViewLayout::InfobarVisible() const { |
| 460 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 455 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 461 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 456 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 462 (infobar_container_->GetPreferredSize().height() != 0); | 457 (infobar_container_->GetPreferredSize().height() != 0); |
| 463 } | 458 } |
| OLD | NEW |