| Flutter Windows Embedder |

Public Member Functions | Static Public Member Functions | List of all members
flutter::AccessibilityPlugin Class Reference

`#include <accessibility_plugin.h>`

## Public Member Functions
| AccessibilityPlugin (FlutterWindowsEngine *engine)
virtual void | Announce (const std::string_view message)

## Static Public Member Functions
static void | SetUp (BinaryMessenger *binary_messenger, AccessibilityPlugin *plugin)

## Detailed Description

Definition at line 21 of file accessibility_plugin.h.

## Constructor & Destructor Documentation

## ◆ AccessibilityPlugin()

flutter::AccessibilityPlugin::AccessibilityPlugin | ( | FlutterWindowsEngine * | engine | ) |
| explicit

Definition at line 73 of file accessibility_plugin.cc.

74 : engine_(engine) {}

## Member Function Documentation

## ◆ Announce()

void flutter::AccessibilityPlugin::Announce | ( | const std::string_view | message | ) |
| virtual

Definition at line 92 of file accessibility_plugin.cc.

92 {
93 if (!engine_->semantics_enabled()) {
94 return;
95 }
96
97 // TODO(loicsharma): Remove implicit view assumption.
98 // https://github.com/flutter/flutter/issues/142845
99 auto view = engine_->view(kImplicitViewId);
100 if (!view) {
101 return;
102 }
103
104 std::wstring wide_text = fml::Utf8ToWideString(message);
105 view->AnnounceAlert(wide_text);
106 }
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:674
flutter::FlutterWindowsEngine::semantics_enabled
bool semantics_enabled() const
Definition: flutter_windows_engine.h:249
message
Win32Message message
Definition: keyboard_unittests.cc:137
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:55

References flutter::kImplicitViewId, message, flutter::FlutterWindowsEngine::semantics_enabled(), and flutter::FlutterWindowsEngine::view().

## ◆ SetUp()

void flutter::AccessibilityPlugin::SetUp | ( | BinaryMessenger * | binary_messenger,
|  | AccessibilityPlugin * | plugin
| ) |  |
| static

Definition at line 76 of file accessibility_plugin.cc.

77 {
78 BasicMessageChannel<> channel{binary_messenger, kAccessibilityChannelName,
79 &StandardMessageCodec::GetInstance()};
80
81 channel.SetMessageHandler(
82 [plugin](const EncodableValue& message,
83 const MessageReply<EncodableValue>& reply) {
84 HandleMessage(plugin, message);
85
86 // The accessibility channel does not support error handling.
87 // Always return an empty response even on failure.
88 reply(EncodableValue{std::monostate{}});
89 });
90 }
flutter::StandardMessageCodec::GetInstance
static const StandardMessageCodec & GetInstance(const StandardCodecSerializer *serializer=nullptr)
Definition: standard_codec.cc:293
kAccessibilityChannelName
static constexpr char kAccessibilityChannelName[]
Definition: flutter_windows_engine.cc:34

References flutter::StandardMessageCodec::GetInstance(), kAccessibilityChannelName, and message.

The documentation for this class was generated from the following files:

- shell/platform/windows/accessibility_plugin.h
- shell/platform/windows/accessibility_plugin.cc