blob: 238b2855da0973d7e522a85a92a5f74eff0ab5b7 [file] [log] [blame]
// Copyright 2018 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 <memory>
#include "ash/ash_export.h"
namespace ui {
class Event;
class EventRewriter;
} // namespace ui
namespace ash {
class SpokenFeedbackEventRewriterDelegate;
// Allows clients to toggle some event rewriting behavior.
class ASH_EXPORT EventRewriterController {
// Returns the singleton EventRewriterController instance.
static EventRewriterController* Get();
// Takes ownership of |rewriter| and adds it to the current event sources.
virtual void AddEventRewriter(
std::unique_ptr<ui::EventRewriter> rewriter) = 0;
// Enables the KeyboardDrivenEventRewriter, which is disabled by default.
// This only applies when the user is on the login screen.
virtual void SetKeyboardDrivenEventRewriterEnabled(bool enabled) = 0;
// If true, Shift + Arrow keys are rewritten to Tab/Shift-Tab keys.
// This only applies when the KeyboardDrivenEventRewriter is active.
virtual void SetArrowToTabRewritingEnabled(bool enabled) = 0;
// Set the delegate used by the spoken feedback event rewriter.
virtual void SetSpokenFeedbackEventRewriterDelegate(
SpokenFeedbackEventRewriterDelegate* delegate) = 0;
// Continue dispatch of key events that were unhandled by ChromeVox.
// TODO( ChromeVox should not repost unhandled events.
virtual void OnUnhandledSpokenFeedbackEvent(
std::unique_ptr<ui::Event> event) = 0;
// Discards key events and sends to spoken feedback when true.
virtual void CaptureAllKeysForSpokenFeedback(bool capture) = 0;
// Sends mouse events to ChromeVox when true.
virtual void SetSendMouseEventsToDelegate(bool value) = 0;
virtual ~EventRewriterController() {}
} // namespace ash