6
6
7
7
#include < variant>
8
8
9
+ #include " flutter/fml/logging.h"
9
10
#include " flutter/fml/platform/win/wstring_conversion.h"
10
11
#include " flutter/shell/platform/common/client_wrapper/include/flutter/standard_message_codec.h"
11
12
#include " flutter/shell/platform/windows/flutter_windows_engine.h"
@@ -26,16 +27,27 @@ static constexpr char kAnnounceValue[] = "announce";
26
27
void HandleMessage (AccessibilityPlugin* plugin, const EncodableValue& message) {
27
28
const auto * map = std::get_if<EncodableMap>(&message);
28
29
if (!map) {
30
+ FML_LOG (ERROR) << " Accessibility message must be a map." ;
29
31
return ;
30
32
}
31
33
const auto & type_itr = map->find (EncodableValue{kTypeKey });
32
34
const auto & data_itr = map->find (EncodableValue{kDataKey });
33
- if (type_itr == map->end () || data_itr == map->end ()) {
35
+ if (type_itr == map->end ()) {
36
+ FML_LOG (ERROR) << " Accessibility message must have a 'type' property." ;
37
+ return ;
38
+ }
39
+ if (data_itr == map->end ()) {
40
+ FML_LOG (ERROR) << " Accessibility message must have a 'data' property." ;
34
41
return ;
35
42
}
36
43
const auto * type = std::get_if<std::string>(&type_itr->second );
37
44
const auto * data = std::get_if<EncodableMap>(&data_itr->second );
38
- if (!type || !data) {
45
+ if (!type) {
46
+ FML_LOG (ERROR) << " Accessibility message 'type' property must be a string." ;
47
+ return ;
48
+ }
49
+ if (!data) {
50
+ FML_LOG (ERROR) << " Accessibility message 'data' property must be a map." ;
39
51
return ;
40
52
}
41
53
@@ -50,6 +62,9 @@ void HandleMessage(AccessibilityPlugin* plugin, const EncodableValue& message) {
50
62
}
51
63
52
64
plugin->Announce (*message);
65
+ } else {
66
+ FML_LOG (ERROR) << " Accessibility message type '" << *type
67
+ << " ' is not supported." ;
53
68
}
54
69
}
55
70
0 commit comments