| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 128   return tabstrip_->IsPositionInWindowCaption(tabstrip_point); | 128   return tabstrip_->IsPositionInWindowCaption(tabstrip_point); | 
| 129 } | 129 } | 
| 130 | 130 | 
| 131 int BrowserViewLayout::NonClientHitTest( | 131 int BrowserViewLayout::NonClientHitTest( | 
| 132     const gfx::Point& point) { | 132     const gfx::Point& point) { | 
| 133   // Since the TabStrip only renders in some parts of the top of the window, | 133   // Since the TabStrip only renders in some parts of the top of the window, | 
| 134   // the un-obscured area is considered to be part of the non-client caption | 134   // the un-obscured area is considered to be part of the non-client caption | 
| 135   // area of the window. So we need to treat hit-tests in these regions as | 135   // area of the window. So we need to treat hit-tests in these regions as | 
| 136   // hit-tests of the titlebar. | 136   // hit-tests of the titlebar. | 
| 137 | 137 | 
| 138   views::View* parent = browser_view_->GetParent(); | 138   views::View* parent = browser_view_->parent(); | 
| 139 | 139 | 
| 140   gfx::Point point_in_browser_view_coords(point); | 140   gfx::Point point_in_browser_view_coords(point); | 
| 141   views::View::ConvertPointToView( | 141   views::View::ConvertPointToView( | 
| 142       parent, browser_view_, &point_in_browser_view_coords); | 142       parent, browser_view_, &point_in_browser_view_coords); | 
| 143 | 143 | 
| 144   // Determine if the TabStrip exists and is capable of being clicked on. We | 144   // Determine if the TabStrip exists and is capable of being clicked on. We | 
| 145   // might be a popup window without a TabStrip. | 145   // might be a popup window without a TabStrip. | 
| 146   if (browser_view_->IsTabStripVisible()) { | 146   if (browser_view_->IsTabStripVisible()) { | 
| 147     // See if the mouse pointer is within the bounds of the TabStrip. | 147     // See if the mouse pointer is within the bounds of the TabStrip. | 
| 148     gfx::Point point_in_tabstrip_coords(point); | 148     gfx::Point point_in_tabstrip_coords(point); | 
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 292 int BrowserViewLayout::LayoutTabStrip() { | 292 int BrowserViewLayout::LayoutTabStrip() { | 
| 293   if (!browser_view_->IsTabStripVisible()) { | 293   if (!browser_view_->IsTabStripVisible()) { | 
| 294     tabstrip_->SetVisible(false); | 294     tabstrip_->SetVisible(false); | 
| 295     tabstrip_->SetBounds(0, 0, 0, 0); | 295     tabstrip_->SetBounds(0, 0, 0, 0); | 
| 296     return 0; | 296     return 0; | 
| 297   } | 297   } | 
| 298 | 298 | 
| 299   gfx::Rect tabstrip_bounds( | 299   gfx::Rect tabstrip_bounds( | 
| 300       browser_view_->frame()->GetBoundsForTabStrip(tabstrip_)); | 300       browser_view_->frame()->GetBoundsForTabStrip(tabstrip_)); | 
| 301   gfx::Point tabstrip_origin(tabstrip_bounds.origin()); | 301   gfx::Point tabstrip_origin(tabstrip_bounds.origin()); | 
| 302   views::View::ConvertPointToView(browser_view_->GetParent(), browser_view_, | 302   views::View::ConvertPointToView(browser_view_->parent(), browser_view_, | 
| 303                                   &tabstrip_origin); | 303                                   &tabstrip_origin); | 
| 304   tabstrip_bounds.set_origin(tabstrip_origin); | 304   tabstrip_bounds.set_origin(tabstrip_origin); | 
| 305 | 305 | 
| 306   if (browser_view_->UseVerticalTabs()) | 306   if (browser_view_->UseVerticalTabs()) | 
| 307     vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0); | 307     vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0); | 
| 308 | 308 | 
| 309   tabstrip_->SetVisible(true); | 309   tabstrip_->SetVisible(true); | 
| 310   tabstrip_->SetBoundsRect(tabstrip_bounds); | 310   tabstrip_->SetBoundsRect(tabstrip_bounds); | 
| 311   return browser_view_->UseVerticalTabs() ? | 311   return browser_view_->UseVerticalTabs() ? | 
| 312       tabstrip_bounds.y() : tabstrip_bounds.bottom(); | 312       tabstrip_bounds.y() : tabstrip_bounds.bottom(); | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 376 // Note that |future_parent_offset| is relative to browser_view_, not to | 376 // Note that |future_parent_offset| is relative to browser_view_, not to | 
| 377 // the parent view. | 377 // the parent view. | 
| 378 void BrowserViewLayout::UpdateReservedContentsRect( | 378 void BrowserViewLayout::UpdateReservedContentsRect( | 
| 379     const gfx::Rect& browser_reserved_rect, | 379     const gfx::Rect& browser_reserved_rect, | 
| 380     TabContentsContainer* source, | 380     TabContentsContainer* source, | 
| 381     const gfx::Rect& future_source_bounds, | 381     const gfx::Rect& future_source_bounds, | 
| 382     const gfx::Point& future_parent_offset) { | 382     const gfx::Point& future_parent_offset) { | 
| 383   gfx::Point resize_corner_origin(browser_reserved_rect.origin()); | 383   gfx::Point resize_corner_origin(browser_reserved_rect.origin()); | 
| 384   // Convert |resize_corner_origin| from browser_view_ to source's parent | 384   // Convert |resize_corner_origin| from browser_view_ to source's parent | 
| 385   // coordinates. | 385   // coordinates. | 
| 386   views::View::ConvertPointToView(browser_view_, source->GetParent(), | 386   views::View::ConvertPointToView(browser_view_, source->parent(), | 
| 387                                   &resize_corner_origin); | 387                                   &resize_corner_origin); | 
| 388   // Create |reserved_rect| in source's parent coordinates. | 388   // Create |reserved_rect| in source's parent coordinates. | 
| 389   gfx::Rect reserved_rect(resize_corner_origin, browser_reserved_rect.size()); | 389   gfx::Rect reserved_rect(resize_corner_origin, browser_reserved_rect.size()); | 
| 390   // Apply source's parent future offset to it. | 390   // Apply source's parent future offset to it. | 
| 391   reserved_rect.Offset(-future_parent_offset.x(), -future_parent_offset.y()); | 391   reserved_rect.Offset(-future_parent_offset.x(), -future_parent_offset.y()); | 
| 392   if (future_source_bounds.Intersects(reserved_rect)) { | 392   if (future_source_bounds.Intersects(reserved_rect)) { | 
| 393     // |source| is not properly positioned yet to use ConvertPointToView, | 393     // |source| is not properly positioned yet to use ConvertPointToView, | 
| 394     // so convert it into |source|'s coordinates manually. | 394     // so convert it into |source|'s coordinates manually. | 
| 395     reserved_rect.Offset(-future_source_bounds.x(), -future_source_bounds.y()); | 395     reserved_rect.Offset(-future_source_bounds.x(), -future_source_bounds.y()); | 
| 396   } else { | 396   } else { | 
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 515     bottom -= height; | 515     bottom -= height; | 
| 516   } | 516   } | 
| 517   return bottom; | 517   return bottom; | 
| 518 } | 518 } | 
| 519 | 519 | 
| 520 bool BrowserViewLayout::InfobarVisible() const { | 520 bool BrowserViewLayout::InfobarVisible() const { | 
| 521   // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 521   // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 
| 522   return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 522   return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 
| 523       (infobar_container_->GetPreferredSize().height() != 0); | 523       (infobar_container_->GetPreferredSize().height() != 0); | 
| 524 } | 524 } | 
| OLD | NEW | 
|---|