Flutter Windows Embedder
accessibility_bridge_windows.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_WINDOWS_ACCESSIBILITY_BRIDGE_WINDOWS_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_ACCESSIBILITY_BRIDGE_WINDOWS_H_
7 
8 #include "flutter/fml/macros.h"
10 #include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_delegate_win.h"
11 
12 namespace flutter {
13 
14 class FlutterWindowsEngine;
15 class FlutterWindowsView;
16 class FlutterPlatformNodeDelegateWindows;
17 
18 // The Win32 implementation of AccessibilityBridge.
19 //
20 // This interacts with Windows accessibility APIs, which includes routing
21 // accessibility events fired from the framework to Windows, routing native
22 // Windows accessibility events to the framework, and creating Windows-specific
23 // FlutterPlatformNodeDelegate objects for each node in the semantics tree.
24 ///
25 /// AccessibilityBridgeWindows must be created as a shared_ptr, since some
26 /// methods acquires its weak_ptr.
28  public ui::AXFragmentRootDelegateWin {
29  public:
31  virtual ~AccessibilityBridgeWindows() = default;
32 
33  // |AccessibilityBridge|
35  FlutterSemanticsAction action,
36  fml::MallocMapping data) override;
37 
38  // Dispatches a Windows accessibility event of the specified type, generated
39  // by the accessibility node associated with the specified semantics node.
40  //
41  // This is a virtual method for the convenience of unit tests.
42  virtual void DispatchWinAccessibilityEvent(
43  std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate,
44  ax::mojom::Event event_type);
45 
46  // Sets the accessibility focus to the accessibility node associated with the
47  // specified semantics node.
48  //
49  // This is a virtual method for the convenience of unit tests.
50  virtual void SetFocus(
51  std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate);
52 
53  // |AXFragmentRootDelegateWin|
54  gfx::NativeViewAccessible GetChildOfAXFragmentRoot() override;
55 
56  // |AXFragmentRootDelegateWin|
57  gfx::NativeViewAccessible GetParentOfAXFragmentRoot() override;
58 
59  // |AXFragmentRootDelegateWin|
60  bool IsAXFragmentRootAControlElement() override;
61 
62  protected:
63  // |AccessibilityBridge|
65  ui::AXEventGenerator::TargetedEvent targeted_event) override;
66 
67  // |AccessibilityBridge|
68  std::shared_ptr<FlutterPlatformNodeDelegate>
70 
71  // Retrieve the focused node for accessibility events.
72  virtual std::weak_ptr<FlutterPlatformNodeDelegate> GetFocusedNode();
73 
74  private:
75  FlutterWindowsView* view_;
76 
77  FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeWindows);
78 };
79 
80 } // namespace flutter
81 
82 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_ACCESSIBILITY_BRIDGE_WINDOWS_H_
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:34
flutter::AccessibilityBridgeWindows::OnAccessibilityEvent
void OnAccessibilityEvent(ui::AXEventGenerator::TargetedEvent targeted_event) override
Handle accessibility events generated due to accessibility tree changes. These events are needed to b...
Definition: accessibility_bridge_windows.cc:18
flutter::AccessibilityBridgeWindows
Definition: accessibility_bridge_windows.h:27
flutter::AccessibilityBridgeWindows::IsAXFragmentRootAControlElement
bool IsAXFragmentRootAControlElement() override
Definition: accessibility_bridge_windows.cc:201
flutter::AccessibilityBridgeWindows::AccessibilityBridgeWindows
AccessibilityBridgeWindows(FlutterWindowsView *view)
Definition: accessibility_bridge_windows.cc:13
flutter::AccessibilityBridge
Definition: accessibility_bridge.h:40
flutter::AccessibilityBridgeWindows::GetChildOfAXFragmentRoot
gfx::NativeViewAccessible GetChildOfAXFragmentRoot() override
Definition: accessibility_bridge_windows.cc:187
flutter::AccessibilityBridgeWindows::DispatchAccessibilityAction
void DispatchAccessibilityAction(AccessibilityNodeId target, FlutterSemanticsAction action, fml::MallocMapping data) override
Dispatch accessibility action back to the Flutter framework. These actions are generated in the nativ...
Definition: accessibility_bridge_windows.cc:162
flutter::AccessibilityBridgeWindows::DispatchWinAccessibilityEvent
virtual void DispatchWinAccessibilityEvent(std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate, ax::mojom::Event event_type)
Definition: accessibility_bridge_windows.cc:175
flutter::AccessibilityNodeId
ui::AXNode::AXID AccessibilityNodeId
Definition: flutter_platform_node_delegate.h:15
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::AccessibilityBridgeWindows::~AccessibilityBridgeWindows
virtual ~AccessibilityBridgeWindows()=default
flutter::AccessibilityBridgeWindows::CreateFlutterPlatformNodeDelegate
std::shared_ptr< FlutterPlatformNodeDelegate > CreateFlutterPlatformNodeDelegate() override
Creates a platform specific FlutterPlatformNodeDelegate. Ownership passes to the caller....
Definition: accessibility_bridge_windows.cc:170
flutter::AccessibilityBridgeWindows::SetFocus
virtual void SetFocus(std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate)
Definition: accessibility_bridge_windows.cc:181
flutter::AccessibilityBridgeWindows::GetFocusedNode
virtual std::weak_ptr< FlutterPlatformNodeDelegate > GetFocusedNode()
Definition: accessibility_bridge_windows.cc:206
action
int action
Definition: keyboard_key_handler_unittests.cc:116
event_type
ax::mojom::Event event_type
Definition: accessibility_bridge_windows_unittests.cc:34
accessibility_bridge.h
flutter::AccessibilityBridgeWindows::GetParentOfAXFragmentRoot
gfx::NativeViewAccessible GetParentOfAXFragmentRoot() override
Definition: accessibility_bridge_windows.cc:197
node_delegate
std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate
Definition: accessibility_bridge_windows_unittests.cc:33