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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp

Issue 2474743002: [DevTools] migrate DOMDebugger, Input, DeviceOrientation, Tracing to new style (Closed)
Patch Set: rebased Created 4 years, 1 month 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: third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
index 965dd20bb8979783118356e5b7d5c27a31922f1a..5270c482e00d69bc2568dfa8b08b5a15a01889e7 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
@@ -139,23 +139,20 @@ InspectorInputAgent::InspectorInputAgent(InspectedFrames* inspectedFrames)
InspectorInputAgent::~InspectorInputAgent() {}
-void InspectorInputAgent::dispatchTouchEvent(
- ErrorString* error,
+Response InspectorInputAgent::dispatchTouchEvent(
const String& type,
std::unique_ptr<protocol::Array<protocol::Input::TouchPoint>> touchPoints,
- const protocol::Maybe<int>& modifiers,
- const protocol::Maybe<double>& timestamp) {
+ protocol::Maybe<int> modifiers,
+ protocol::Maybe<double> timestamp) {
PlatformEvent::EventType convertedType;
- if (type == "touchStart") {
+ if (type == "touchStart")
convertedType = PlatformEvent::TouchStart;
- } else if (type == "touchEnd") {
+ else if (type == "touchEnd")
convertedType = PlatformEvent::TouchEnd;
- } else if (type == "touchMove") {
+ else if (type == "touchMove")
convertedType = PlatformEvent::TouchMove;
- } else {
- *error = String("Unrecognized type: " + type);
- return;
- }
+ else
+ return Response::Error(String("Unrecognized type: " + type));
unsigned convertedModifiers = GetEventModifiers(modifiers.fromMaybe(0));
@@ -180,28 +177,25 @@ void InspectorInputAgent::dispatchTouchEvent(
id = autoId++;
}
if (id < 0) {
- *error =
+ return Response::Error(
"All or none of the provided TouchPoints must supply positive "
- "integer ids.";
- return;
+ "integer ids.");
}
PlatformTouchPoint::TouchState convertedState;
String state = point->getState();
- if (state == "touchPressed") {
+ if (state == "touchPressed")
convertedState = PlatformTouchPoint::TouchPressed;
- } else if (state == "touchReleased") {
+ else if (state == "touchReleased")
convertedState = PlatformTouchPoint::TouchReleased;
- } else if (state == "touchMoved") {
+ else if (state == "touchMoved")
convertedState = PlatformTouchPoint::TouchMoved;
- } else if (state == "touchStationary") {
+ else if (state == "touchStationary")
convertedState = PlatformTouchPoint::TouchStationary;
- } else if (state == "touchCancelled") {
+ else if (state == "touchCancelled")
convertedState = PlatformTouchPoint::TouchCancelled;
- } else {
- *error = String("Unrecognized state: " + state);
- return;
- }
+ else
+ return Response::Error(String("Unrecognized state: " + state));
// Some platforms may have flipped coordinate systems, but the given
// coordinates assume the origin is in the top-left of the window. Convert.
@@ -217,6 +211,7 @@ void InspectorInputAgent::dispatchTouchEvent(
}
m_inspectedFrames->root()->eventHandler().handleTouchEvent(event);
+ return Response::OK();
}
DEFINE_TRACE(InspectorInputAgent) {

Powered by Google App Engine
This is Rietveld 408576698