summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/frame/browser_view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/frame/browser_view.cc')
-rw-r--r--chrome/browser/views/frame/browser_view.cc83
1 files changed, 28 insertions, 55 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 90b4f23..becc26a 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -431,10 +431,8 @@ int BrowserView::GetTabStripHeight() const {
// We want to return tabstrip_->height(), but we might be called in the midst
// of layout, when that hasn't yet been updated to reflect the current state.
// So return what the tabstrip height _ought_ to be right now.
- views::View* tabstrip =
- TabStrip2::Enabled() ? static_cast<views::View*>(bts_)
- : static_cast<views::View*>(tabstrip_);
- return IsTabStripVisible() ? tabstrip->GetPreferredSize().height() : 0;
+ return IsTabStripVisible() ? tabstrip_->GetView()->GetPreferredSize().height()
+ : 0;
}
gfx::Rect BrowserView::GetTabStripBounds() const {
@@ -945,8 +943,7 @@ void BrowserView::ShowHTMLDialog(HtmlDialogUIDelegate* delegate,
}
void BrowserView::ContinueDraggingDetachedTab(const gfx::Rect& tab_bounds) {
- DCHECK(TabStrip2::Enabled());
- bts_->SetDraggedTabBounds(0, tab_bounds);
+ tabstrip_->SetDraggedTabBounds(0, tab_bounds);
frame_->ContinueDraggingDetachedTab();
}
@@ -1228,7 +1225,7 @@ views::ClientView* BrowserView::CreateClientView(views::Window* window) {
bool BrowserView::CanClose() const {
// You cannot close a frame for which there is an active originating drag
// session.
- if (!TabStrip2::Enabled() && tabstrip_->IsDragSessionActive())
+ if (tabstrip_->IsDragSessionActive())
return false;
// Give beforeunload handlers the chance to cancel the close before we hide
@@ -1286,21 +1283,21 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
View::ConvertPointToView(GetParent(), this, &point_in_view_coords);
// See if the mouse pointer is within the bounds of the TabStrip.
- if (!TabStrip2::Enabled()) {
- gfx::Point point_in_tabstrip_coords(point);
- View::ConvertPointToView(GetParent(), tabstrip_, &point_in_tabstrip_coords);
- if (tabstrip_->HitTest(point_in_tabstrip_coords)) {
- if (tabstrip_->PointIsWithinWindowCaption(point_in_tabstrip_coords))
- return HTCAPTION;
- return HTCLIENT;
- }
+ gfx::Point point_in_tabstrip_coords(point);
+ View::ConvertPointToView(GetParent(), tabstrip_->GetView(),
+ &point_in_tabstrip_coords);
+ if (tabstrip_->GetView()->HitTest(point_in_tabstrip_coords)) {
+ if (tabstrip_->PointIsWithinWindowCaption(point_in_tabstrip_coords))
+ return HTCAPTION;
+ return HTCLIENT;
}
// The top few pixels of the TabStrip are a drop-shadow - as we're pretty
// starved of dragable area, let's give it to window dragging (this also
// makes sense visually).
- if (!TabStrip2::Enabled() && !IsMaximized() &&
- (point_in_view_coords.y() < tabstrip_->y() + kTabShadowSize)) {
+ if (!IsMaximized() &&
+ (point_in_view_coords.y() <
+ (tabstrip_->GetView()->y() + kTabShadowSize))) {
// We return HTNOWHERE as this is a signal to our containing
// NonClientView that it should figure out what the correct hit-test
// code is given the mouse position...
@@ -1312,13 +1309,8 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
// within the bounds of this view, the point is considered to be within the
// client area.
gfx::Rect bv_bounds = bounds();
- if (TabStrip2::Enabled()) {
- bv_bounds.Offset(0, bts_->y());
- bv_bounds.set_height(bv_bounds.height() - bts_->y());
- } else {
- bv_bounds.Offset(0, toolbar_->y());
- bv_bounds.set_height(bv_bounds.height() - toolbar_->y());
- }
+ bv_bounds.Offset(0, toolbar_->y());
+ bv_bounds.set_height(bv_bounds.height() - toolbar_->y());
if (bv_bounds.Contains(point))
return HTCLIENT;
@@ -1342,14 +1334,11 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
}
gfx::Size BrowserView::GetMinimumSize() {
- views::View* tabstrip =
- TabStrip2::Enabled() ? static_cast<views::View*>(bts_)
- : static_cast<views::View*>(tabstrip_);
// TODO(noname): In theory the tabstrip width should probably be
// (OTR + tabstrip + caption buttons) width.
gfx::Size tabstrip_size(
browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
- tabstrip->GetMinimumSize() : gfx::Size());
+ tabstrip_->GetView()->GetMinimumSize() : gfx::Size());
gfx::Size toolbar_size(
(browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) ?
@@ -1438,16 +1427,10 @@ void BrowserView::Init() {
LoadAccelerators();
SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
- if (TabStrip2::Enabled()) {
- bts_ = new BrowserTabStrip(browser_->tabstrip_model());
- AddChildView(bts_);
- } else {
- tabstrip_ = new TabStrip(browser_->tabstrip_model());
- tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
- AddChildView(tabstrip_);
- tabstrip_->InitTabStripButtons();
- frame_->TabStripCreated(tabstrip_);
- }
+ tabstrip_ = TabStripWrapper::CreateTabStrip(browser_->tabstrip_model());
+ tabstrip_->GetView()->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
+ AddChildView(tabstrip_->GetView());
+ frame_->TabStripCreated(tabstrip_);
toolbar_ = new ToolbarView(browser_.get());
AddChildView(toolbar_);
@@ -1496,14 +1479,9 @@ void BrowserView::InitSystemMenu() {
int BrowserView::LayoutTabStrip() {
gfx::Rect tabstrip_bounds;
- if (TabStrip2::Enabled()) {
- tabstrip_bounds = gfx::Rect(0, 0, width(),
- bts_->GetPreferredSize().height());
- } else {
- tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_);
- tabstrip_->SetBackgroundOffset(
- gfx::Point(tabstrip_bounds.x(), tabstrip_bounds.y()));
- }
+ tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_);
+ tabstrip_->SetBackgroundOffset(
+ gfx::Point(tabstrip_bounds.x(), tabstrip_bounds.y()));
gfx::Point tabstrip_origin = tabstrip_bounds.origin();
ConvertPointToView(GetParent(), this, &tabstrip_origin);
tabstrip_bounds.set_origin(tabstrip_origin);
@@ -1511,13 +1489,9 @@ int BrowserView::LayoutTabStrip() {
int y = visible ? tabstrip_bounds.y() : 0;
int height = visible ? tabstrip_bounds.height() : 0;
int bottom = y + height;
- if (TabStrip2::Enabled()) {
- gfx::Size btsps = bts_->GetPreferredSize();
- bts_->SetBounds(tabstrip_bounds.x(), y, width(), btsps.height());
- } else {
- tabstrip_->SetVisible(visible);
- tabstrip_->SetBounds(tabstrip_bounds.x(), y, tabstrip_bounds.width(), height);
- }
+ tabstrip_->GetView()->SetVisible(visible);
+ tabstrip_->GetView()->SetBounds(tabstrip_bounds.x(), y,
+ tabstrip_bounds.width(), height);
return bottom;
}
@@ -1834,8 +1808,7 @@ void BrowserView::LoadingAnimationCallback() {
// will return false for fullscreen windows, but we still need to update
// their animations (so that when they come out of fullscreen mode they'll
// be correct).
- if (!TabStrip2::Enabled())
- tabstrip_->UpdateLoadingAnimations();
+ tabstrip_->UpdateLoadingAnimations();
} else if (ShouldShowWindowIcon()) {
// ... or in the window icon area for popups and app windows.
TabContents* tab_contents = browser_->GetSelectedTabContents();