Flutter Engine
The Flutter Engine
ax_action_handler_base.h
Go to the documentation of this file.
1// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_ACCESSIBILITY_AX_ACTION_HANDLER_BASE_H_
6#define UI_ACCESSIBILITY_AX_ACTION_HANDLER_BASE_H_
7
8#include "ax_export.h"
9#include "ax_tree_id.h"
10
11namespace ui {
12
13struct AXActionData;
14
15// Classes that host an accessibility tree in the browser process that also wish
16// to become visible to accessibility clients (e.g. for relaying targets to
17// source accessibility trees), can subclass this class. However, unless you
18// need to have more control over how |tree_id_| is set, most classes will want
19// to inherit from AXActionHandler instead, which manages it automatically.
20//
21// Subclasses can use |tree_id| when annotating their |AXNodeData| for clients
22// to respond with the appropriate target node id.
24 public:
25 virtual ~AXActionHandlerBase();
26
27 // Handle an action from an accessibility client.
28 virtual void PerformAction(const AXActionData& data) = 0;
29
30 // Returns whether this handler expects points in pixels (true) or dips
31 // (false) for data passed to |PerformAction|.
32 virtual bool RequiresPerformActionPointInPixels() const;
33
34 // A tree id appropriate for annotating events sent to an accessibility
35 // client.
36 const AXTreeID& ax_tree_id() const { return tree_id_; }
37
38 protected:
39 // Initializes the AXActionHandlerBase subclass with ui::AXTreeIDUnknown().
41
42 // Initializes the AXActionHandlerBase subclass with |ax_tree_id|. It is Ok to
43 // pass ui::AXTreeIDUnknown() and then call SetAXTreeID() at a later point.
44 explicit AXActionHandlerBase(const AXTreeID& ax_tree_id);
45
46 // Change the AXTreeID.
47 void SetAXTreeID(AXTreeID new_ax_tree_id);
48
49 private:
50 // Register or unregister this class with |AXTreeIDRegistry|.
51 void UpdateActiveState(bool active);
52
53 // Manually set in this base class, but automatically set by instances of the
54 // subclass AXActionHandler, which most classes inherit from.
55 AXTreeID tree_id_;
56};
57
58} // namespace ui
59
60#endif // UI_ACCESSIBILITY_AX_ACTION_HANDLER_BASE_H_
#define AX_EXPORT
Definition: ax_export.h:29
const AXTreeID & ax_tree_id() const
virtual void PerformAction(const AXActionData &data)=0
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63