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

Unified Diff: content/browser/android/in_process/synchronous_input_event_filter.cc

Issue 15920002: Fix WebView compositor input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid DCHECKs when retrieving process ID Created 7 years, 6 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/android/in_process/synchronous_input_event_filter.cc
diff --git a/content/browser/android/in_process/synchronous_input_event_filter.cc b/content/browser/android/in_process/synchronous_input_event_filter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a0f96fee8e5e238b9306fc006588efe51e8edee1
--- /dev/null
+++ b/content/browser/android/in_process/synchronous_input_event_filter.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/android/in_process/synchronous_input_event_filter.h"
+
+#include "content/public/browser/browser_thread.h"
+
+using WebKit::WebInputEvent;
+
+namespace content {
+
+SynchronousInputEventFilter::SynchronousInputEventFilter() {
+}
+
+SynchronousInputEventFilter::~SynchronousInputEventFilter() {
+}
+
+InputEventAckState SynchronousInputEventFilter::HandleInputEvent(
+ int routing_id,
+ const WebKit::WebInputEvent& input_event) {
+ // The handler will be empty both before renderer initialization and after
+ // renderer destruction. It's possible that this will be reached in such a
+ // state. While not good, it should also not be fatal.
+ if (handler_.is_null())
+ return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
+
+ return handler_.Run(routing_id, &input_event);
+}
+
+void SynchronousInputEventFilter::SetBoundHandler(const Handler& handler) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&SynchronousInputEventFilter::SetBoundHandlerOnUIThread,
+ base::Unretained(this), handler));
+}
+
+void SynchronousInputEventFilter::SetBoundHandlerOnUIThread(
+ const Handler& handler) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ handler_ = handler;
+}
+
+} // namespace content
« no previous file with comments | « content/browser/android/in_process/synchronous_input_event_filter.h ('k') | content/browser/android/sync_input_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698