Flutter Engine
The Flutter Engine
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) {}
FlutterEngine engine
Definition: main.cc:68

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}
FlutterWindowsView * view(FlutterViewId view_id) const
Win32Message message
constexpr FlutterViewId kImplicitViewId
std::wstring Utf8ToWideString(const std::string_view str)

◆ 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,
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}
static const StandardMessageCodec & GetInstance(const StandardCodecSerializer *serializer=nullptr)
static constexpr char kAccessibilityChannelName[]

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