12
12
13
13
static constexpr char kChannelName [] = " flutter/platform_views" ;
14
14
15
- std::string extractStringFromMap (const flutter::EncodableValue& arguments,
15
+ std::string ExtractStringFromMap (const flutter::EncodableValue& arguments,
16
16
const char * key) {
17
17
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
18
18
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -22,7 +22,7 @@ std::string extractStringFromMap(const flutter::EncodableValue& arguments,
22
22
}
23
23
return std::string ();
24
24
}
25
- int extractIntFromMap (const flutter::EncodableValue& arguments,
25
+ int ExtractIntFromMap (const flutter::EncodableValue& arguments,
26
26
const char * key) {
27
27
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
28
28
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -31,7 +31,7 @@ int extractIntFromMap(const flutter::EncodableValue& arguments,
31
31
}
32
32
return -1 ;
33
33
}
34
- double extractDoubleFromMap (const flutter::EncodableValue& arguments,
34
+ double ExtractDoubleFromMap (const flutter::EncodableValue& arguments,
35
35
const char * key) {
36
36
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
37
37
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -41,7 +41,7 @@ double extractDoubleFromMap(const flutter::EncodableValue& arguments,
41
41
return -1 ;
42
42
}
43
43
44
- flutter::EncodableMap extractMapFromMap (
44
+ flutter::EncodableMap ExtractMapFromMap (
45
45
const flutter::EncodableValue& arguments, const char * key) {
46
46
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
47
47
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -52,7 +52,7 @@ flutter::EncodableMap extractMapFromMap(
52
52
return flutter::EncodableMap ();
53
53
}
54
54
55
- flutter::EncodableList extractListFromMap (
55
+ flutter::EncodableList ExtractListFromMap (
56
56
const flutter::EncodableValue& arguments, const char * key) {
57
57
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
58
58
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -77,34 +77,34 @@ PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger)
77
77
PlatformViewChannel::~PlatformViewChannel () {
78
78
// Clean-up view_factories_
79
79
for (auto const & [viewType, viewFactory] : view_factories_) {
80
- viewFactory->dispose ();
80
+ viewFactory->Dispose ();
81
81
}
82
82
view_factories_.clear ();
83
83
84
84
// Clean-up view_instances_
85
85
for (auto const & [viewId, viewInstance] : view_instances_) {
86
- viewInstance->dispose ();
86
+ viewInstance->Dispose ();
87
87
delete viewInstance;
88
88
}
89
89
view_instances_.clear ();
90
90
}
91
91
92
- void PlatformViewChannel::sendKeyEvent (Ecore_Event_Key* key, bool is_down) {
93
- auto instances = viewInstances ();
94
- auto it = instances.find (currentFocusedViewId ());
92
+ void PlatformViewChannel::SendKeyEvent (Ecore_Event_Key* key, bool is_down) {
93
+ auto instances = ViewInstances ();
94
+ auto it = instances.find (CurrentFocusedViewId ());
95
95
if (it != instances.end ()) {
96
96
if (is_down) {
97
- it->second ->dispatchKeyDownEvent (key);
97
+ it->second ->DispatchKeyDownEvent (key);
98
98
} else {
99
- it->second ->dispatchKeyUpEvent (key);
99
+ it->second ->DispatchKeyUpEvent (key);
100
100
}
101
101
}
102
102
}
103
103
104
- int PlatformViewChannel::currentFocusedViewId () {
104
+ int PlatformViewChannel::CurrentFocusedViewId () {
105
105
for (auto it = view_instances_.begin (); it != view_instances_.end (); it++) {
106
- if (it->second ->isFocused ()) {
107
- return it->second ->getViewId ();
106
+ if (it->second ->IsFocused ()) {
107
+ return it->second ->GetViewId ();
108
108
}
109
109
}
110
110
return -1 ;
@@ -117,10 +117,10 @@ void PlatformViewChannel::HandleMethodCall(
117
117
const auto & arguments = *call.arguments ();
118
118
119
119
if (method == " create" ) {
120
- std::string viewType = extractStringFromMap (arguments, " viewType" );
121
- int viewId = extractIntFromMap (arguments, " id" );
122
- double width = extractDoubleFromMap (arguments, " width" );
123
- double height = extractDoubleFromMap (arguments, " height" );
120
+ std::string viewType = ExtractStringFromMap (arguments, " viewType" );
121
+ int viewId = ExtractIntFromMap (arguments, " id" );
122
+ double width = ExtractDoubleFromMap (arguments, " width" );
123
+ double height = ExtractDoubleFromMap (arguments, " height" );
124
124
125
125
LoggerD (
126
126
" PlatformViewChannel create viewType: %s id: %d width: %f height: %f " ,
@@ -134,14 +134,14 @@ void PlatformViewChannel::HandleMethodCall(
134
134
}
135
135
auto it = view_factories_.find (viewType);
136
136
if (it != view_factories_.end ()) {
137
- auto focuesdView = view_instances_.find (currentFocusedViewId ());
137
+ auto focuesdView = view_instances_.find (CurrentFocusedViewId ());
138
138
if (focuesdView != view_instances_.end ()) {
139
- focuesdView->second ->setFocus (false );
139
+ focuesdView->second ->SetFocus (false );
140
140
}
141
141
142
142
auto viewInstance =
143
- it->second ->create (viewId, width, height, byteMessage);
144
- viewInstance->setFocus (true );
143
+ it->second ->Create (viewId, width, height, byteMessage);
144
+ viewInstance->SetFocus (true );
145
145
view_instances_.insert (
146
146
std::pair<int , PlatformView*>(viewId, viewInstance));
147
147
@@ -150,30 +150,30 @@ void PlatformViewChannel::HandleMethodCall(
150
150
channel_->InvokeMethod (" viewFocused" , std::move (id));
151
151
}
152
152
153
- result->Success (flutter::EncodableValue (viewInstance->getTextureId ()));
153
+ result->Success (flutter::EncodableValue (viewInstance->GetTextureId ()));
154
154
} else {
155
155
LoggerE (" can't find view type = %s" , viewType.c_str ());
156
156
result->Error (" 0" , " can't find view type" );
157
157
}
158
158
} else {
159
- int viewId = extractIntFromMap (arguments, " id" );
159
+ int viewId = ExtractIntFromMap (arguments, " id" );
160
160
auto it = view_instances_.find (viewId);
161
161
if (viewId >= 0 && it != view_instances_.end ()) {
162
162
if (method == " dispose" ) {
163
163
LoggerD (" PlatformViewChannel dispose" );
164
- it->second ->dispose ();
164
+ it->second ->Dispose ();
165
165
result->Success ();
166
166
} else if (method == " resize" ) {
167
167
LoggerD (" PlatformViewChannel resize" );
168
- double width = extractDoubleFromMap (arguments, " width" );
169
- double height = extractDoubleFromMap (arguments, " height" );
170
- it->second ->resize (width, height);
168
+ double width = ExtractDoubleFromMap (arguments, " width" );
169
+ double height = ExtractDoubleFromMap (arguments, " height" );
170
+ it->second ->Resize (width, height);
171
171
result->NotImplemented ();
172
172
} else if (method == " touch" ) {
173
173
int type, button;
174
174
double x, y, dx, dy;
175
175
176
- flutter::EncodableList event = extractListFromMap (arguments, " event" );
176
+ flutter::EncodableList event = ExtractListFromMap (arguments, " event" );
177
177
if (event.size () != 6 ) {
178
178
result->Error (" Invalid Arguments" );
179
179
return ;
@@ -185,14 +185,14 @@ void PlatformViewChannel::HandleMethodCall(
185
185
dx = std::get<double >(event[4 ]);
186
186
dy = std::get<double >(event[5 ]);
187
187
188
- it->second ->touch (type, button, x, y, dx, dy);
188
+ it->second ->Touch (type, button, x, y, dx, dy);
189
189
result->Success ();
190
190
} else if (method == " setDirection" ) {
191
191
LoggerD (" PlatformViewChannel setDirection" );
192
192
result->NotImplemented ();
193
193
} else if (method == " clearFocus" ) {
194
194
LoggerD (" PlatformViewChannel clearFocus" );
195
- it->second ->clearFocus ();
195
+ it->second ->ClearFocus ();
196
196
result->NotImplemented ();
197
197
} else {
198
198
LoggerD (" Unimplemented method: %s" , method.c_str ());
0 commit comments