Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 983853002: Hide close buttons of inactive stacked tabs by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: histograms.xml changed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_)
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | chrome/browser/ui/views/tabs/tab_strip_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698