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

Unified Diff: chrome/browser/renderer_host/render_widget_host.cc

Issue 160494: Disable input events when a JS dialog is showing. (Closed)
Patch Set: beforeunload Created 11 years, 4 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 | « chrome/browser/renderer_host/render_view_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host.cc
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 8328d60ed7e7f261890579db16464a13bf6ea810..996f63f124f4b5c174013a304a9ce70fece290bb 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -345,6 +345,9 @@ void RenderWidgetHost::SystemThemeChanged() {
}
void RenderWidgetHost::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
+ if (process_->ignore_input_events())
+ return;
+
// Avoid spamming the renderer with mouse move events. It is important
// to note that WM_MOUSEMOVE events are anyways synthetic, but since our
// thread is able to rapidly consume WM_MOUSEMOVE events, we may get way
@@ -364,11 +367,17 @@ void RenderWidgetHost::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
void RenderWidgetHost::ForwardWheelEvent(
const WebMouseWheelEvent& wheel_event) {
+ if (process_->ignore_input_events())
+ return;
+
ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent));
}
void RenderWidgetHost::ForwardKeyboardEvent(
const NativeWebKeyboardEvent& key_event) {
+ if (process_->ignore_input_events())
+ return;
+
if (key_event.type == WebKeyboardEvent::Char &&
(key_event.windowsKeyCode == base::VKEY_RETURN ||
key_event.windowsKeyCode == base::VKEY_SPACE)) {
@@ -398,6 +407,8 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event,
if (!process_->HasConnection())
return;
+ DCHECK(!process_->ignore_input_events());
+
IPC::Message* message = new ViewMsg_HandleInputEvent(routing_id_);
message->WriteData(
reinterpret_cast<const char*>(&input_event), event_size);
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698