blob: 725bfcf97c68eddfb180e867c5c6ccc69c37ca5e [file] [log] [blame]
// Copyright 2017 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 "base/callback.h"
#include "services/ws/public/mojom/event_injector.mojom.h"
#include "ui/aura/aura_export.h"
namespace ui {
class Event;
struct EventDispatchDetails;
namespace aura {
class WindowTreeHost;
// Used to inject events into the system. In LOCAL mode, it directly injects
// events into the WindowTreeHost, but in MUS mode, it injects events into the
// window-service (over the mojom API).
class AURA_EXPORT EventInjector {
// Inject |event| to |host|. |callback| is optional that gets invoked after
// the event is processed by |host|. In LOCAL mode, |callback| is invoked
// synchronously. In MUS mode, it is invoked after a response is received
// from the window service (via mojo). If |event| is a LocatedEvent, then
// coordinates are relative to host and in DIPs.
ui::EventDispatchDetails Inject(
WindowTreeHost* host,
ui::Event* event,
base::OnceClosure callback = base::OnceClosure());
ws::mojom::EventInjectorPtr event_injector_;
bool has_pending_callback_ = false;
} // namespace aura