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

Unified Diff: content/browser/renderer_host/input/browser_input_event.cc

Issue 19220002: [WIP] BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix client assignment Created 7 years, 3 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/renderer_host/input/browser_input_event.cc
diff --git a/content/browser/renderer_host/input/browser_input_event.cc b/content/browser/renderer_host/input/browser_input_event.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d2459ea07e7786db80f0072ce1361f4570ffa89
--- /dev/null
+++ b/content/browser/renderer_host/input/browser_input_event.cc
@@ -0,0 +1,47 @@
+// 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/renderer_host/input/browser_input_event.h"
+
+#include "content/common/input/web_input_event_payload.h"
+
+namespace content {
+
+BrowserInputEvent::BrowserInputEvent(BrowserInputEventClient* client)
+ : client_(client) {}
+
+BrowserInputEvent::~BrowserInputEvent() {}
+
+scoped_ptr<BrowserInputEvent> BrowserInputEvent::Create(
+ int64 id,
+ scoped_ptr<InputEvent::Payload> payload,
+ BrowserInputEventClient* client) {
+ DCHECK(client);
+ scoped_ptr<BrowserInputEvent> event(new BrowserInputEvent(client));
+ event->Initialize(id, payload.Pass());
+ return event.Pass();
+}
+
+void BrowserInputEvent::OnDispatched(
+ InputEventDisposition disposition,
+ ScopedVector<BrowserInputEvent>* followup_events) {
+ DCHECK(followup_events);
+
+ bool event_consumed =
+ disposition == INPUT_EVENT_MAIN_THREAD_CONSUMED ||
+ disposition == INPUT_EVENT_IMPL_THREAD_CONSUMED ||
+ disposition == INPUT_EVENT_MAIN_THREAD_PREVENT_DEFAULTED;
+
+ if (!event_consumed && CanCreateFollowupEvents())
+ client_->OnDispatched(*this, disposition, followup_events);
+ else
+ client_->OnDispatched(*this, disposition);
+}
+
+bool BrowserInputEvent::CanCreateFollowupEvents() const {
+ return payload()->GetType() == InputEvent::Payload::WEB_INPUT_EVENT &&
+ WebInputEventPayload::Cast(payload())->CanCreateFollowupEvents();
+}
+
+} // namespace content
« no previous file with comments | « content/browser/renderer_host/input/browser_input_event.h ('k') | content/browser/renderer_host/input/buffered_input_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698