| 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
|
|
|