| 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" |
| 11 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 11 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_frame.h" | 12 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 13 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 14 #include "chrome/browser/ui/views/frame/contents_container.h" | 14 #include "chrome/browser/ui/views/frame/contents_container.h" |
| 15 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 15 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 16 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 16 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
| 17 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" | 17 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" |
| 18 #include "chrome/browser/ui/views/toolbar_view.h" | 18 #include "chrome/browser/ui/views/toolbar_view.h" |
| 19 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
| 20 #include "ui/gfx/point.h" | 20 #include "ui/gfx/point.h" |
| 21 #include "ui/gfx/scrollbar_size.h" | 21 #include "ui/gfx/scrollbar_size.h" |
| 22 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
| 23 #include "views/controls/single_split_view.h" | 23 #include "views/controls/single_split_view.h" |
| 24 | 24 |
| 25 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 25 #if !defined(OS_CHROMEOS) |
| 26 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 26 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // The visible height of the shadow above the tabs. Clicks in this area are | 31 // The visible height of the shadow above the tabs. Clicks in this area are |
| 32 // treated as clicks to the frame, rather than clicks to the tab. | 32 // treated as clicks to the frame, rather than clicks to the tab. |
| 33 const int kTabShadowSize = 2; | 33 const int kTabShadowSize = 2; |
| 34 // The vertical overlap between the TabStrip and the Toolbar. | 34 // The vertical overlap between the TabStrip and the Toolbar. |
| 35 const int kToolbarTabStripVerticalOverlap = 3; | 35 const int kToolbarTabStripVerticalOverlap = 3; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // We're installed as the LayoutManager before BrowserView creates the | 224 // We're installed as the LayoutManager before BrowserView creates the |
| 225 // contents, so we have to set contents_container_ here rather than in | 225 // contents, so we have to set contents_container_ here rather than in |
| 226 // Installed. | 226 // Installed. |
| 227 contents_container_ = browser_view_->contents_; | 227 contents_container_ = browser_view_->contents_; |
| 228 break; | 228 break; |
| 229 } | 229 } |
| 230 case VIEW_ID_INFO_BAR_CONTAINER: | 230 case VIEW_ID_INFO_BAR_CONTAINER: |
| 231 infobar_container_ = view; | 231 infobar_container_ = view; |
| 232 break; | 232 break; |
| 233 case VIEW_ID_DOWNLOAD_SHELF: | 233 case VIEW_ID_DOWNLOAD_SHELF: |
| 234 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 234 #if !defined(OS_CHROMEOS) |
| 235 download_shelf_ = static_cast<DownloadShelfView*>(view); | 235 download_shelf_ = static_cast<DownloadShelfView*>(view); |
| 236 #else | 236 #else |
| 237 NOTREACHED(); | 237 NOTREACHED(); |
| 238 #endif | 238 #endif |
| 239 break; | 239 break; |
| 240 case VIEW_ID_BOOKMARK_BAR: | 240 case VIEW_ID_BOOKMARK_BAR: |
| 241 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); | 241 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); |
| 242 break; | 242 break; |
| 243 case VIEW_ID_TOOLBAR: | 243 case VIEW_ID_TOOLBAR: |
| 244 toolbar_ = static_cast<ToolbarView*>(view); | 244 toolbar_ = static_cast<ToolbarView*>(view); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 sidebar_split->child_at(1)->IsVisible()) | 507 sidebar_split->child_at(1)->IsVisible()) |
| 508 return 0; | 508 return 0; |
| 509 } | 509 } |
| 510 | 510 |
| 511 // Adjust for separator. | 511 // Adjust for separator. |
| 512 return active_bookmark_bar_->height() - | 512 return active_bookmark_bar_->height() - |
| 513 views::NonClientFrameView::kClientEdgeThickness; | 513 views::NonClientFrameView::kClientEdgeThickness; |
| 514 } | 514 } |
| 515 | 515 |
| 516 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { | 516 int BrowserViewLayout::LayoutDownloadShelf(int bottom) { |
| 517 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 517 #if !defined(OS_CHROMEOS) |
| 518 // Re-layout the shelf either if it is visible or if it's close animation | 518 // Re-layout the shelf either if it is visible or if it's close animation |
| 519 // is currently running. ChromiumOS uses ActiveDownloadsUI instead of | 519 // is currently running. ChromiumOS uses ActiveDownloadsUI instead of |
| 520 // DownloadShelf. | 520 // DownloadShelf. |
| 521 if (browser_view_->IsDownloadShelfVisible() || | 521 if (browser_view_->IsDownloadShelfVisible() || |
| 522 (download_shelf_ && download_shelf_->IsClosing())) { | 522 (download_shelf_ && download_shelf_->IsClosing())) { |
| 523 bool visible = browser()->SupportsWindowFeature( | 523 bool visible = browser()->SupportsWindowFeature( |
| 524 Browser::FEATURE_DOWNLOADSHELF); | 524 Browser::FEATURE_DOWNLOADSHELF); |
| 525 DCHECK(download_shelf_); | 525 DCHECK(download_shelf_); |
| 526 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; | 526 int height = visible ? download_shelf_->GetPreferredSize().height() : 0; |
| 527 download_shelf_->SetVisible(visible); | 527 download_shelf_->SetVisible(visible); |
| 528 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, | 528 download_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, |
| 529 vertical_layout_rect_.width(), height); | 529 vertical_layout_rect_.width(), height); |
| 530 download_shelf_->Layout(); | 530 download_shelf_->Layout(); |
| 531 bottom -= height; | 531 bottom -= height; |
| 532 } | 532 } |
| 533 #endif | 533 #endif |
| 534 return bottom; | 534 return bottom; |
| 535 } | 535 } |
| 536 | 536 |
| 537 bool BrowserViewLayout::InfobarVisible() const { | 537 bool BrowserViewLayout::InfobarVisible() const { |
| 538 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 538 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 539 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 539 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 540 (infobar_container_->GetPreferredSize().height() != 0); | 540 (infobar_container_->GetPreferredSize().height() != 0); |
| 541 } | 541 } |
| OLD | NEW |