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

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

Issue 1408363004: [DevTools] Filter any messages from previous sessions in DevToolsAgentHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: content/browser/devtools/protocol/input_handler.cc
diff --git a/content/browser/devtools/protocol/input_handler.cc b/content/browser/devtools/protocol/input_handler.cc
index 0b4bdcc3f5422f1a0e2d1f189c2f28e9e545f084..21c49be3ec458bf8de4e49c0c4dd9ea147d1316c 100644
--- a/content/browser/devtools/protocol/input_handler.cc
+++ b/content/browser/devtools/protocol/input_handler.cc
@@ -306,6 +306,7 @@ Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type,
}
Response InputHandler::SynthesizePinchGesture(
+ int session_id,
DevToolsCommandId command_id,
int x,
int y,
@@ -332,12 +333,13 @@ Response InputHandler::SynthesizePinchGesture(
host_->QueueSyntheticGesture(
SyntheticGesture::Create(gesture_params),
base::Bind(&InputHandler::SendSynthesizePinchGestureResponse,
- weak_factory_.GetWeakPtr(), command_id));
+ weak_factory_.GetWeakPtr(), session_id, command_id));
return Response::OK();
}
Response InputHandler::SynthesizeScrollGesture(
+ int session_id,
DevToolsCommandId command_id,
int x,
int y,
@@ -385,7 +387,8 @@ Response InputHandler::SynthesizeScrollGesture(
gesture_params, repeat_count ? *repeat_count : 0,
base::TimeDelta::FromMilliseconds(repeat_delay_ms ? *repeat_delay_ms
: 250),
- interaction_marker_name ? *interaction_marker_name : "", command_id);
+ interaction_marker_name ? *interaction_marker_name : "", session_id,
+ command_id);
return Response::OK();
}
@@ -395,6 +398,7 @@ void InputHandler::SynthesizeRepeatingScroll(
int repeat_count,
base::TimeDelta repeat_delay,
std::string interaction_marker_name,
+ int session_id,
DevToolsCommandId command_id) {
if (!interaction_marker_name.empty()) {
// TODO(alexclarke): Can we move this elsewhere? It doesn't really fit here.
@@ -406,7 +410,7 @@ void InputHandler::SynthesizeRepeatingScroll(
SyntheticGesture::Create(gesture_params),
base::Bind(&InputHandler::OnScrollFinished, weak_factory_.GetWeakPtr(),
gesture_params, repeat_count, repeat_delay,
- interaction_marker_name, command_id));
+ interaction_marker_name, session_id, command_id));
}
void InputHandler::OnScrollFinished(
@@ -414,6 +418,7 @@ void InputHandler::OnScrollFinished(
int repeat_count,
base::TimeDelta repeat_delay,
std::string interaction_marker_name,
+ int session_id,
DevToolsCommandId command_id,
SyntheticGesture::Result result) {
if (!interaction_marker_name.empty()) {
@@ -423,17 +428,18 @@ void InputHandler::OnScrollFinished(
if (repeat_count > 0) {
base::MessageLoop::current()->task_runner()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&InputHandler::SynthesizeRepeatingScroll,
- weak_factory_.GetWeakPtr(), gesture_params, repeat_count - 1,
- repeat_delay, interaction_marker_name, command_id),
+ FROM_HERE, base::Bind(&InputHandler::SynthesizeRepeatingScroll,
+ weak_factory_.GetWeakPtr(), gesture_params,
+ repeat_count - 1, repeat_delay,
+ interaction_marker_name, session_id, command_id),
repeat_delay);
} else {
- SendSynthesizeScrollGestureResponse(command_id, result);
+ SendSynthesizeScrollGestureResponse(session_id, command_id, result);
}
}
Response InputHandler::SynthesizeTapGesture(
+ int session_id,
DevToolsCommandId command_id,
int x,
int y,
@@ -466,49 +472,54 @@ Response InputHandler::SynthesizeTapGesture(
host_->QueueSyntheticGesture(
SyntheticGesture::Create(gesture_params),
base::Bind(&InputHandler::SendSynthesizeTapGestureResponse,
- weak_factory_.GetWeakPtr(), command_id, is_last_tap));
+ weak_factory_.GetWeakPtr(), session_id, command_id,
+ is_last_tap));
}
return Response::OK();
}
void InputHandler::SendSynthesizePinchGestureResponse(
+ int session_id,
DevToolsCommandId command_id,
SyntheticGesture::Result result) {
+ // todo: session_id
if (result == SyntheticGesture::Result::GESTURE_FINISHED) {
client_->SendSynthesizePinchGestureResponse(
- command_id, SynthesizePinchGestureResponse::Create());
+ session_id, command_id, SynthesizePinchGestureResponse::Create());
} else {
- client_->SendError(command_id,
+ client_->SendError(session_id, command_id,
Response::InternalError(base::StringPrintf(
"Synthetic pinch failed, result was %d", result)));
}
}
void InputHandler::SendSynthesizeScrollGestureResponse(
+ int session_id,
DevToolsCommandId command_id,
SyntheticGesture::Result result) {
if (result == SyntheticGesture::Result::GESTURE_FINISHED) {
client_->SendSynthesizeScrollGestureResponse(
- command_id, SynthesizeScrollGestureResponse::Create());
+ session_id, command_id, SynthesizeScrollGestureResponse::Create());
} else {
- client_->SendError(command_id,
+ client_->SendError(session_id, command_id,
Response::InternalError(base::StringPrintf(
"Synthetic scroll failed, result was %d", result)));
}
}
void InputHandler::SendSynthesizeTapGestureResponse(
+ int session_id,
DevToolsCommandId command_id,
bool send_success,
SyntheticGesture::Result result) {
if (result == SyntheticGesture::Result::GESTURE_FINISHED) {
if (send_success) {
client_->SendSynthesizeTapGestureResponse(
- command_id, SynthesizeTapGestureResponse::Create());
+ session_id, command_id, SynthesizeTapGestureResponse::Create());
}
} else {
- client_->SendError(command_id,
+ client_->SendError(session_id, command_id,
Response::InternalError(base::StringPrintf(
"Synthetic tap failed, result was %d", result)));
}

Powered by Google App Engine
This is Rietveld 408576698