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

Unified Diff: content/browser/devtools/protocol/page_handler.cc

Issue 821223002: Pass gesture detector config type when enabling touch emulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@touch-emulator-enabled
Patch Set: Created 6 years 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
Index: content/browser/devtools/protocol/page_handler.cc
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc
index 903fac7224d6b0ef674aa0a083eb927231831cd8..80ebf8394a9050849ed8929f3c90197d2f71937d 100644
--- a/content/browser/devtools/protocol/page_handler.cc
+++ b/content/browser/devtools/protocol/page_handler.cc
@@ -50,6 +50,21 @@ static int kFrameRetryDelayMs = 100;
static int kCaptureRetryLimit = 2;
static int kMaxScreencastFramesInFlight = 2;
+ui::GestureProviderConfigType TouchEmulationConfigurationToType(
+ const std::string& protocol_value) {
+ ui::GestureProviderConfigType result =
+ ui::GestureProviderConfigType::CURRENT_PLATFORM;
+ if (protocol_value ==
+ set_touch_emulation_enabled::kConfigurationMobile) {
+ result = ui::GestureProviderConfigType::GENERIC_MOBILE;
+ }
+ if (protocol_value ==
+ set_touch_emulation_enabled::kConfigurationDesktop) {
+ result = ui::GestureProviderConfigType::GENERIC_DESKTOP;
+ }
+ return result;
+}
+
void QueryUsageAndQuotaCompletedOnIOThread(
const UsageAndQuotaQuery::Callback& callback,
scoped_refptr<QueryUsageAndQuotaResponse> response) {
@@ -313,12 +328,6 @@ Response PageHandler::ClearGeolocationOverride() {
return Response::OK();
}
-Response PageHandler::SetTouchEmulationEnabled(bool enabled) {
- touch_emulation_enabled_ = enabled;
- UpdateTouchEventEmulationState();
- return Response::FallThrough();
-}
-
Response PageHandler::SetTouchEmulationEnabled(
bool enabled, const std::string* configuration) {
touch_emulation_enabled_ = enabled;
@@ -466,8 +475,9 @@ void PageHandler::UpdateTouchEventEmulationState() {
if (!host_)
return;
bool enabled = touch_emulation_enabled_ || screencast_enabled_;
- // TODO(dgozman): pass |touch_emulation_configuration_| once supported.
- host_->SetTouchEventEmulationEnabled(enabled);
+ ui::GestureProviderConfigType config_type =
+ TouchEmulationConfigurationToType(touch_emulation_configuration_);
+ host_->SetTouchEventEmulationEnabled(enabled, config_type);
WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
WebContents::FromRenderViewHost(host_));
if (web_contents)

Powered by Google App Engine
This is Rietveld 408576698