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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 19805005: Refactored touch-events flag test, correcting "enabled" logic. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed IsTouchEnabled to AreTouchEventsEnabled. Created 7 years, 5 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 | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/base/touch/touch_enabled.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 71dc1dff3d54a26b90bbc431f2160ca65ab4a256..a9037428375a4c41003be4442ae3f2d23d7cee13 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/lazy_instance.h"
+#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/stats_counters.h"
#include "base/strings/string16.h"
@@ -81,6 +82,7 @@
#include "third_party/WebKit/public/web/WebView.h"
#include "ui/base/layout.h"
#include "ui/base/touch/touch_device.h"
+#include "ui/base/touch/touch_enabled.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
@@ -559,23 +561,9 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh,
switches::kDisableGestureRequirementForMediaPlayback);
#endif
- bool touch_device_present = false;
- touch_device_present = ui::IsTouchDevicePresent();
- const std::string touch_enabled_switch =
- command_line.HasSwitch(switches::kTouchEvents) ?
- command_line.GetSwitchValueASCII(switches::kTouchEvents) :
- switches::kTouchEventsAuto;
-
- if (touch_enabled_switch.empty() ||
- touch_enabled_switch == switches::kTouchEventsEnabled) {
- prefs.touch_enabled = true;
- } else if (touch_enabled_switch == switches::kTouchEventsAuto) {
- prefs.touch_enabled = touch_device_present;
- } else if (touch_enabled_switch != switches::kTouchEventsDisabled) {
- LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
- }
-
- prefs.device_supports_touch = prefs.touch_enabled && touch_device_present;
+ prefs.touch_enabled = ui::AreTouchEventsEnabled();
+ prefs.device_supports_touch = prefs.touch_enabled &&
+ ui::IsTouchDevicePresent();
#if defined(OS_ANDROID)
prefs.device_supports_mouse = false;
#endif
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/base/touch/touch_enabled.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698