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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 893843007: Experiment to hide close buttons of inactive tabs when using touch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added flag to histograms.xml Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | chrome/browser/ui/views/tabs/tab_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f35c59c116d6678bf01458eec734ce2e8fa943bd..cffe4a382cf33dd5dae4ce08be2b7f75e74bd46d 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/metrics/histogram.h"
#include "base/stl_util.h"
@@ -27,6 +28,7 @@
#include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
#include "chrome/browser/ui/views/tabs/tab_strip_observer.h"
#include "chrome/browser/ui/views/touch_uma/touch_uma.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/user_metrics.h"
#include "grit/theme_resources.h"
@@ -967,6 +969,30 @@ bool TabStrip::SupportsMultipleSelection() {
return touch_layout_ == NULL;
}
+// TODO(tdanderson): Modify this logic and clean up related code once a
+// decision has been made on the experimental
+// flag --tab-close-buttons-hidden-with-touch.
+bool TabStrip::ShouldHideCloseButtonForInactiveTab(const Tab* tab) {
+ DCHECK(!tab->IsActive());
+
+ // Do not force the close button to hide if mouse was used as
+ // the last input type to interact with the tab strip.
+ if (!stacked_layout_)
+ return false;
+
+ std::string switch_value =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kTabCloseButtonsHiddenWithTouch);
+ int width = tab->width();
+ if (switch_value == "always" ||
+ (switch_value == "narrow" && width < Tab::GetStandardSize().width()) ||
+ (switch_value == "stacked" && width <= Tab::GetTouchWidth())) {
+ return true;
+ }
+
+ return false;
+}
+
void TabStrip::SelectTab(Tab* tab) {
int model_index = GetModelIndexOfTab(tab);
if (IsValidModelIndex(model_index))
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | chrome/browser/ui/views/tabs/tab_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698