Skip to content

Commit

Permalink
Revert "Disable legacy touch event APIs on desktop"
Browse files Browse the repository at this point in the history
This CL reverts commit a6a203c.
(crrev.com/c/729220)

We'll leave these feature detection API disabled in canary and
dev channel to gather some feedback. But don't let it in Beta
and Stable channel because it breaks embed map.

This revert will merge into into M68, but not landed in master branch

Bug: 804890
Change-Id: Ib017006081baf12b69fe137ba9aeae915b5274a3
Reviewed-on: https://chromium-review.googlesource.com/1081874
Reviewed-by: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/branch-heads/3440@{#85}
Cr-Branched-From: 010ddcf-refs/heads/master@{#561733}
  • Loading branch information
EiraGe committed Jun 1, 2018
1 parent c1d1d4e commit c4e3ca9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
6 changes: 3 additions & 3 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ const unsigned kOsAura = kOsWin | kOsLinux | kOsCrOS;
#endif // USE_AURA

const FeatureEntry::Choice kTouchEventFeatureDetectionChoices[] = {
{flags_ui::kGenericExperimentChoiceDisabled, "", ""},
{flags_ui::kGenericExperimentChoiceAutomatic, "", ""},
{flags_ui::kGenericExperimentChoiceEnabled,
switches::kTouchEventFeatureDetection,
switches::kTouchEventFeatureDetectionEnabled},
{flags_ui::kGenericExperimentChoiceAutomatic,
{flags_ui::kGenericExperimentChoiceDisabled,
switches::kTouchEventFeatureDetection,
switches::kTouchEventFeatureDetectionAuto}};
switches::kTouchEventFeatureDetectionDisabled}};

#if defined(USE_AURA)
const FeatureEntry::Choice kOverscrollHistoryNavigationChoices[] = {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ const char kTouchEventsName[] = "Touch Events API";
const char kTouchEventsDescription[] =
"Force Touch Events API feature detection to always be enabled or "
"disabled, or to be enabled when a touchscreen is detected on startup "
"(Automatic).";
"(Automatic, the default).";

const char kTouchSelectionStrategyName[] = "Touch text selection strategy";
const char kTouchSelectionStrategyDescription[] =
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/prefs/chrome_pref_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
Expand Down Expand Up @@ -99,11 +98,4 @@ TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) {
EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont),
webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]);
EXPECT_TRUE(webkit_prefs.javascript_enabled);

#if defined(OS_ANDROID)
// Touch event enabled only on Android.
EXPECT_TRUE(webkit_prefs.touch_event_feature_detection_enabled);
#else
EXPECT_FALSE(webkit_prefs.touch_event_feature_detection_enabled);
#endif
}
10 changes: 1 addition & 9 deletions content/browser/renderer_host/render_view_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,26 +460,18 @@ WebPreferences RenderViewHostImpl::ComputeWebkitPrefs() {
NOTREACHED();
}

// On Android, Touch event feature detection is enabled by default,
// Otherwise default is disabled.
std::string touch_enabled_default_switch =
switches::kTouchEventFeatureDetectionDisabled;
#if defined(OS_ANDROID)
touch_enabled_default_switch = switches::kTouchEventFeatureDetectionEnabled;
#endif // defined(OS_ANDROID)
const std::string touch_enabled_switch =
command_line.HasSwitch(switches::kTouchEventFeatureDetection)
? command_line.GetSwitchValueASCII(
switches::kTouchEventFeatureDetection)
: touch_enabled_default_switch;
: switches::kTouchEventFeatureDetectionAuto;
prefs.touch_event_feature_detection_enabled =
(touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto)
? (ui::GetTouchScreensAvailability() ==
ui::TouchScreensAvailability::ENABLED)
: (touch_enabled_switch.empty() ||
touch_enabled_switch ==
switches::kTouchEventFeatureDetectionEnabled);

std::tie(prefs.available_pointer_types, prefs.available_hover_types) =
ui::GetAvailablePointerAndHoverTypes();
prefs.primary_pointer_type =
Expand Down

0 comments on commit c4e3ca9

Please sign in to comment.