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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
962 | 962 |
963 const ui::ListSelectionModel& TabStrip::GetSelectionModel() { | 963 const ui::ListSelectionModel& TabStrip::GetSelectionModel() { |
964 return controller_->GetSelectionModel(); | 964 return controller_->GetSelectionModel(); |
965 } | 965 } |
966 | 966 |
967 bool TabStrip::SupportsMultipleSelection() { | 967 bool TabStrip::SupportsMultipleSelection() { |
968 // TODO: currently only allow single selection in touch layout mode. | 968 // TODO: currently only allow single selection in touch layout mode. |
969 return touch_layout_ == NULL; | 969 return touch_layout_ == NULL; |
970 } | 970 } |
971 | 971 |
972 // TODO(tdanderson): Modify this logic and clean up related code once a | 972 bool TabStrip::ShouldHideCloseButtonForInactiveTabs() { |
973 // decision has been made on the experimental | 973 if (!touch_layout_) |
sky
2015/03/09 19:55:59
I was wrong here. My understanding is you always w
tdanderson
2015/03/11 18:01:38
Actually, you were right. Using |touch_layout_| is
| |
974 // flag --tab-close-buttons-hidden-with-touch. | |
975 bool TabStrip::ShouldHideCloseButtonForInactiveTab(const Tab* tab) { | |
976 DCHECK(!tab->IsActive()); | |
977 | |
978 // Do not force the close button to hide if mouse was used as | |
979 // the last input type to interact with the tab strip. | |
980 if (!stacked_layout_) | |
981 return false; | 974 return false; |
982 | 975 |
983 std::string switch_value = | 976 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
984 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 977 switches::kDisableHideInactiveStackedTabCloseButtons); |
985 switches::kTabCloseButtonsHiddenWithTouch); | |
986 int width = tab->width(); | |
987 if (switch_value == "always" || | |
988 (switch_value == "narrow" && width < Tab::GetStandardSize().width()) || | |
989 (switch_value == "stacked" && width <= Tab::GetTouchWidth())) { | |
990 return true; | |
991 } | |
992 | |
993 return false; | |
994 } | 978 } |
995 | 979 |
996 void TabStrip::SelectTab(Tab* tab) { | 980 void TabStrip::SelectTab(Tab* tab) { |
997 int model_index = GetModelIndexOfTab(tab); | 981 int model_index = GetModelIndexOfTab(tab); |
998 if (IsValidModelIndex(model_index)) | 982 if (IsValidModelIndex(model_index)) |
999 controller_->SelectTab(model_index); | 983 controller_->SelectTab(model_index); |
1000 } | 984 } |
1001 | 985 |
1002 void TabStrip::ExtendSelectionTo(Tab* tab) { | 986 void TabStrip::ExtendSelectionTo(Tab* tab) { |
1003 int model_index = GetModelIndexOfTab(tab); | 987 int model_index = GetModelIndexOfTab(tab); |
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2766 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2750 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2767 if (view) | 2751 if (view) |
2768 return view; | 2752 return view; |
2769 } | 2753 } |
2770 Tab* tab = FindTabForEvent(point); | 2754 Tab* tab = FindTabForEvent(point); |
2771 if (tab) | 2755 if (tab) |
2772 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2756 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2773 } | 2757 } |
2774 return this; | 2758 return this; |
2775 } | 2759 } |
OLD | NEW |