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

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

Issue 2898793002: DevTools: disable input event processing while auditing with lighthouse. (Closed)
Patch Set: comments addressed Created 3 years, 7 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
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 967dd2cd21e0a91ca65631cfd8d26ecea4d3a5ba..cc419a3523f453021293befbc3807a5f073f1e75 100644
--- a/content/browser/devtools/protocol/input_handler.cc
+++ b/content/browser/devtools/protocol/input_handler.cc
@@ -211,11 +211,17 @@ std::vector<InputHandler*> InputHandler::ForAgentHost(
void InputHandler::SetRenderFrameHost(RenderFrameHostImpl* host) {
ClearPendingKeyAndMouseCallbacks();
- if (host_)
+ if (host_) {
host_->GetRenderWidgetHost()->RemoveInputEventObserver(this);
+ if (ignore_input_events_)
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(false);
+ }
host_ = host;
- if (host)
+ if (host) {
host->GetRenderWidgetHost()->AddInputEventObserver(this);
+ if (ignore_input_events_)
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(true);
+ }
}
void InputHandler::OnInputEvent(const blink::WebInputEvent& event) {
@@ -246,8 +252,12 @@ void InputHandler::OnSwapCompositorFrame(
Response InputHandler::Disable() {
ClearPendingKeyAndMouseCallbacks();
- if (host_)
+ if (host_) {
host_->GetRenderWidgetHost()->RemoveInputEventObserver(this);
+ if (ignore_input_events_)
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(false);
+ }
+ ignore_input_events_ = false;
return Response::OK();
}
@@ -458,6 +468,13 @@ Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type,
return Response::OK();
}
+Response InputHandler::SetIgnoreInputEvents(bool ignore) {
+ ignore_input_events_ = ignore;
+ if (host_)
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(ignore);
+ return Response::OK();
+}
+
void InputHandler::SynthesizePinchGesture(
int x,
int y,
« no previous file with comments | « content/browser/devtools/protocol/input_handler.h ('k') | third_party/WebKit/Source/core/inspector/browser_protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698