1 // Copyright 2019 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_TARGET_H_ 6 #define UI_ACCESSIBILITY_AX_ACTION_TARGET_H_ 7 8 #include "ui/accessibility/ax_enums.mojom-forward.h" 9 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/rect.h" 11 12 namespace ui { 13 14 // AXActionTarget is an abstract interface that can be used to carry out 15 // accessibility actions on nodes from an AXTreeSource without knowing the 16 // concrete class of that AXTreeSource. 17 class AXActionTarget { 18 public: 19 virtual ~AXActionTarget() = default; 20 21 enum class Type { kNull, kBlink, kPdf }; 22 virtual Type GetType() const = 0; 23 24 virtual bool ClearAccessibilityFocus() const = 0; 25 virtual bool Click() const = 0; 26 virtual bool Decrement() const = 0; 27 virtual bool Increment() const = 0; 28 virtual bool Focus() const = 0; 29 virtual gfx::Rect GetRelativeBounds() const = 0; 30 virtual gfx::Point GetScrollOffset() const = 0; 31 virtual gfx::Point MinimumScrollOffset() const = 0; 32 virtual gfx::Point MaximumScrollOffset() const = 0; 33 virtual bool SetAccessibilityFocus() const = 0; 34 virtual void SetScrollOffset(const gfx::Point& point) const = 0; 35 virtual bool SetSelected(bool selected) const = 0; 36 virtual bool SetSelection(const AXActionTarget* anchor_object, 37 int anchor_offset, 38 const AXActionTarget* focus_object, 39 int focus_offset) const = 0; 40 virtual bool SetSequentialFocusNavigationStartingPoint() const = 0; 41 virtual bool SetValue(const std::string& value) const = 0; 42 virtual bool ShowContextMenu() const = 0; 43 // Make this object visible by scrolling as many nested scrollable views as 44 // needed. 45 virtual bool ScrollToMakeVisible() const = 0; 46 // Same, but if the whole object can't be made visible, try for this subrect, 47 // in local coordinates. 48 virtual bool ScrollToMakeVisibleWithSubFocus( 49 const gfx::Rect& rect, 50 ax::mojom::ScrollAlignment horizontal_scroll_alignment, 51 ax::mojom::ScrollAlignment vertical_scroll_alignment, 52 ax::mojom::ScrollBehavior scroll_behavior) const = 0; 53 // Scroll this object to a given point in global coordinates of the top-level 54 // window. 55 virtual bool ScrollToGlobalPoint(const gfx::Point& point) const = 0; 56 57 protected: 58 AXActionTarget() = default; 59 }; 60 61 } // namespace ui 62 63 #endif // UI_ACCESSIBILITY_AX_ACTION_TARGET_H_ 64