Index: chrome/browser/ui/views/tabs/tab_strip.cc |
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc |
index 5375cdf77e94e123f61aabca1d6bb7699f5b785f..1b2cee4475f18b67a9bfb70bc118725f514c222c 100644 |
--- a/chrome/browser/ui/views/tabs/tab_strip.cc |
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc |
@@ -511,7 +511,7 @@ TabStrip::TabStrip(TabStripController* controller) |
in_tab_close_(false), |
animation_container_(new gfx::AnimationContainer()), |
bounds_animator_(this), |
- layout_type_(TAB_STRIP_LAYOUT_SHRINK), |
+ layout_type_stacked_(false), |
adjust_layout_(false), |
reset_to_shrink_on_exit_(false), |
mouse_move_count_(0), |
@@ -547,10 +547,8 @@ void TabStrip::RemoveObserver(TabStripObserver* observer) { |
observers_.RemoveObserver(observer); |
} |
-void TabStrip::SetLayoutType(TabStripLayoutType layout_type, |
- bool adjust_layout) { |
- adjust_layout_ = adjust_layout; |
- if (layout_type == layout_type_) |
+void TabStrip::SetLayoutTypeStacked(bool layout_type_stacked) { |
+ if (layout_type_stacked == layout_type_stacked_) |
return; |
const int active_index = controller_->GetActiveIndex(); |
@@ -559,7 +557,7 @@ void TabStrip::SetLayoutType(TabStripLayoutType layout_type, |
active_center = ideal_bounds(active_index).x() + |
ideal_bounds(active_index).width() / 2; |
} |
- layout_type_ = layout_type; |
+ layout_type_stacked_ = layout_type_stacked; |
SetResetToShrinkOnExit(false); |
SwapLayoutIfNecessary(); |
// When transitioning to stacked try to keep the active tab centered. |
@@ -1119,7 +1117,7 @@ void TabStrip::MouseMovedOutOfHost() { |
ResizeLayoutTabs(); |
if (reset_to_shrink_on_exit_) { |
reset_to_shrink_on_exit_ = false; |
- SetLayoutType(TAB_STRIP_LAYOUT_SHRINK, true); |
+ SetLayoutTypeStacked(false); |
controller_->LayoutTypeMaybeChanged(); |
} |
} |
@@ -1150,8 +1148,7 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas, |
// Since |touch_layout_| is created based on number of tabs and width we use |
// the ideal state to determine if we should paint stacked. This minimizes |
// painting changes as we switch between the two. |
- const bool stacking = (layout_type_ == TAB_STRIP_LAYOUT_STACKED) || |
- IsStackingDraggedTabs(); |
+ const bool stacking = layout_type_stacked_ || IsStackingDraggedTabs(); |
const chrome::HostDesktopType host_desktop_type = |
chrome::GetHostDesktopTypeForNativeView(GetWidget()->GetNativeView()); |
@@ -1486,7 +1483,7 @@ void TabStrip::OnGestureEvent(ui::GestureEvent* event) { |
case ui::ET_GESTURE_END: |
EndDrag(END_DRAG_COMPLETE); |
if (adjust_layout_) { |
- SetLayoutType(TAB_STRIP_LAYOUT_STACKED, true); |
+ SetLayoutTypeStacked(true); |
controller_->LayoutTypeMaybeChanged(); |
} |
break; |
@@ -2013,7 +2010,7 @@ void TabStrip::UpdateLayoutTypeFromMouseEvent(views::View* source, |
views::View::ConvertPointToTarget(source, this, &tab_strip_point); |
Tab* tab = FindTabForEvent(tab_strip_point); |
if (tab && touch_layout_->IsStacked(GetModelIndexOfTab(tab))) { |
- SetLayoutType(TAB_STRIP_LAYOUT_SHRINK, true); |
+ SetLayoutTypeStacked(false); |
controller_->LayoutTypeMaybeChanged(); |
} |
} |
@@ -2053,7 +2050,7 @@ void TabStrip::UpdateLayoutTypeFromMouseEvent(views::View* source, |
mouse_move_count_ = 0; |
last_mouse_move_time_ = base::TimeTicks(); |
if ((event.flags() & ui::EF_FROM_TOUCH) == ui::EF_FROM_TOUCH) { |
- SetLayoutType(TAB_STRIP_LAYOUT_STACKED, true); |
+ SetLayoutTypeStacked(true); |
controller_->LayoutTypeMaybeChanged(); |
} |
break; |
@@ -2612,7 +2609,7 @@ void TabStrip::SwapLayoutIfNecessary() { |
} |
bool TabStrip::NeedsTouchLayout() const { |
- if (layout_type_ == TAB_STRIP_LAYOUT_SHRINK) |
+ if (!layout_type_stacked_) |
return false; |
int mini_tab_count = GetMiniTabCount(); |
@@ -2629,7 +2626,7 @@ void TabStrip::SetResetToShrinkOnExit(bool value) { |
if (!GetAdjustLayout()) |
return; |
- if (value && layout_type_ == TAB_STRIP_LAYOUT_SHRINK) |
+ if (value && !layout_type_stacked_) |
value = false; // We're already at TAB_STRIP_LAYOUT_SHRINK. |
if (value == reset_to_shrink_on_exit_) |