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

Unified Diff: services/ui/input_manager/input_connection_impl.cc

Issue 1776473005: Mozart: Implement basic input event dispatch with hit testing. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-7
Patch Set: Created 4 years, 9 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: services/ui/input_manager/input_connection_impl.cc
diff --git a/services/ui/input_manager/input_connection_impl.cc b/services/ui/input_manager/input_connection_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e175db412cd5f368caafc7278df77c8503e37179
--- /dev/null
+++ b/services/ui/input_manager/input_connection_impl.cc
@@ -0,0 +1,50 @@
+// Copyright 2016 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 "services/ui/input_manager/input_connection_impl.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "services/ui/input_manager/input_associate.h"
+
+namespace input_manager {
+
+InputConnectionImpl::InputConnectionImpl(
+ InputAssociate* associate,
+ mojo::ui::ViewTokenPtr view_token,
+ mojo::InterfaceRequest<mojo::ui::InputConnection> request)
+ : associate_(associate),
+ view_token_(view_token.Pass()),
+ binding_(this, request.Pass()) {
+ DCHECK(associate_);
+ DCHECK(view_token_);
+ binding_.set_connection_error_handler(
+ base::Bind(&InputAssociate::OnInputConnectionDied,
+ base::Unretained(associate_), base::Unretained(this)));
+}
+
+InputConnectionImpl::~InputConnectionImpl() {}
+
+void InputConnectionImpl::DeliverEvent(mojo::EventPtr event) {
+ // TODO(jeffbrown): Pass the result back up the stack and handle errors.
+ if (!listener_) {
+ DVLOG(1) << "DeliverEvent: dropped because there was no listener";
+ return;
+ }
+
+ listener_->OnEvent(event.Pass(),
+ base::Bind(&InputConnectionImpl::OnEventFinished,
+ base::Unretained(this)));
+}
+
+void InputConnectionImpl::OnEventFinished(bool handled) {
+ // TODO: this code doesn't really belong here
+}
+
+void InputConnectionImpl::SetListener(
+ mojo::InterfaceHandle<mojo::ui::InputListener> listener) {
+ listener_ = mojo::ui::InputListenerPtr::Create(std::move(listener));
+}
+
+} // namespace input_manager
« no previous file with comments | « services/ui/input_manager/input_connection_impl.h ('k') | services/ui/input_manager/input_dispatcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698