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/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 return results; | 2586 return results; |
2587 } | 2587 } |
2588 | 2588 |
2589 void TabStrip::SwapLayoutIfNecessary() { | 2589 void TabStrip::SwapLayoutIfNecessary() { |
2590 bool needs_touch = NeedsTouchLayout(); | 2590 bool needs_touch = NeedsTouchLayout(); |
2591 bool using_touch = touch_layout_ != NULL; | 2591 bool using_touch = touch_layout_ != NULL; |
2592 if (needs_touch == using_touch) | 2592 if (needs_touch == using_touch) |
2593 return; | 2593 return; |
2594 | 2594 |
2595 if (needs_touch) { | 2595 if (needs_touch) { |
2596 gfx::Size tab_size(Tab::GetMinimumActiveSize()); | 2596 gfx::Size tab_size(Tab::GetTouchWidth(), GetLayoutConstant(TAB_HEIGHT)); |
2597 tab_size.set_width(Tab::GetTouchWidth()); | |
2598 touch_layout_.reset(new StackedTabStripLayout( | 2597 touch_layout_.reset(new StackedTabStripLayout( |
2599 tab_size, Tab::kOverlap, kStackedPadding, kMaxStackedCount, &tabs_)); | 2598 tab_size, Tab::kOverlap, kStackedPadding, kMaxStackedCount, &tabs_)); |
2600 touch_layout_->SetWidth(GetTabAreaWidth()); | 2599 touch_layout_->SetWidth(GetTabAreaWidth()); |
2601 // This has to be after SetWidth() as SetWidth() is going to reset the | 2600 // This has to be after SetWidth() as SetWidth() is going to reset the |
2602 // bounds of the pinned tabs (since StackedTabStripLayout doesn't yet know | 2601 // bounds of the pinned tabs (since StackedTabStripLayout doesn't yet know |
2603 // how many pinned tabs there are). | 2602 // how many pinned tabs there are). |
2604 GenerateIdealBoundsForPinnedTabs(NULL); | 2603 GenerateIdealBoundsForPinnedTabs(NULL); |
2605 touch_layout_->SetXAndPinnedCount(GetStartXForNormalTabs(), | 2604 touch_layout_->SetXAndPinnedCount(GetStartXForNormalTabs(), |
2606 GetPinnedTabCount()); | 2605 GetPinnedTabCount()); |
2607 touch_layout_->SetActiveIndex(controller_->GetActiveIndex()); | 2606 touch_layout_->SetActiveIndex(controller_->GetActiveIndex()); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2794 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2796 if (view) | 2795 if (view) |
2797 return view; | 2796 return view; |
2798 } | 2797 } |
2799 Tab* tab = FindTabForEvent(point); | 2798 Tab* tab = FindTabForEvent(point); |
2800 if (tab) | 2799 if (tab) |
2801 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2800 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2802 } | 2801 } |
2803 return this; | 2802 return this; |
2804 } | 2803 } |
OLD | NEW |