Skip to content

Commit 167ac22

Browse files
authored
Change method name starting with lower case (#16)
* According to convention, I change first letter of method name from lower case to upper case. First, I apply only files related to platform view.
1 parent 26a6f7c commit 167ac22

7 files changed

+61
-60
lines changed

shell/platform/tizen/channels/platform_view_channel.cc

+32-32
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
static constexpr char kChannelName[] = "flutter/platform_views";
1414

15-
std::string extractStringFromMap(const flutter::EncodableValue& arguments,
15+
std::string ExtractStringFromMap(const flutter::EncodableValue& arguments,
1616
const char* key) {
1717
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
1818
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -22,7 +22,7 @@ std::string extractStringFromMap(const flutter::EncodableValue& arguments,
2222
}
2323
return std::string();
2424
}
25-
int extractIntFromMap(const flutter::EncodableValue& arguments,
25+
int ExtractIntFromMap(const flutter::EncodableValue& arguments,
2626
const char* key) {
2727
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
2828
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -31,7 +31,7 @@ int extractIntFromMap(const flutter::EncodableValue& arguments,
3131
}
3232
return -1;
3333
}
34-
double extractDoubleFromMap(const flutter::EncodableValue& arguments,
34+
double ExtractDoubleFromMap(const flutter::EncodableValue& arguments,
3535
const char* key) {
3636
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
3737
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -41,7 +41,7 @@ double extractDoubleFromMap(const flutter::EncodableValue& arguments,
4141
return -1;
4242
}
4343

44-
flutter::EncodableMap extractMapFromMap(
44+
flutter::EncodableMap ExtractMapFromMap(
4545
const flutter::EncodableValue& arguments, const char* key) {
4646
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
4747
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -52,7 +52,7 @@ flutter::EncodableMap extractMapFromMap(
5252
return flutter::EncodableMap();
5353
}
5454

55-
flutter::EncodableList extractListFromMap(
55+
flutter::EncodableList ExtractListFromMap(
5656
const flutter::EncodableValue& arguments, const char* key) {
5757
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
5858
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
@@ -77,34 +77,34 @@ PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger)
7777
PlatformViewChannel::~PlatformViewChannel() {
7878
// Clean-up view_factories_
7979
for (auto const& [viewType, viewFactory] : view_factories_) {
80-
viewFactory->dispose();
80+
viewFactory->Dispose();
8181
}
8282
view_factories_.clear();
8383

8484
// Clean-up view_instances_
8585
for (auto const& [viewId, viewInstance] : view_instances_) {
86-
viewInstance->dispose();
86+
viewInstance->Dispose();
8787
delete viewInstance;
8888
}
8989
view_instances_.clear();
9090
}
9191

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());
9595
if (it != instances.end()) {
9696
if (is_down) {
97-
it->second->dispatchKeyDownEvent(key);
97+
it->second->DispatchKeyDownEvent(key);
9898
} else {
99-
it->second->dispatchKeyUpEvent(key);
99+
it->second->DispatchKeyUpEvent(key);
100100
}
101101
}
102102
}
103103

104-
int PlatformViewChannel::currentFocusedViewId() {
104+
int PlatformViewChannel::CurrentFocusedViewId() {
105105
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();
108108
}
109109
}
110110
return -1;
@@ -117,10 +117,10 @@ void PlatformViewChannel::HandleMethodCall(
117117
const auto& arguments = *call.arguments();
118118

119119
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");
124124

125125
LoggerD(
126126
"PlatformViewChannel create viewType: %s id: %d width: %f height: %f ",
@@ -134,14 +134,14 @@ void PlatformViewChannel::HandleMethodCall(
134134
}
135135
auto it = view_factories_.find(viewType);
136136
if (it != view_factories_.end()) {
137-
auto focuesdView = view_instances_.find(currentFocusedViewId());
137+
auto focuesdView = view_instances_.find(CurrentFocusedViewId());
138138
if (focuesdView != view_instances_.end()) {
139-
focuesdView->second->setFocus(false);
139+
focuesdView->second->SetFocus(false);
140140
}
141141

142142
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);
145145
view_instances_.insert(
146146
std::pair<int, PlatformView*>(viewId, viewInstance));
147147

@@ -150,30 +150,30 @@ void PlatformViewChannel::HandleMethodCall(
150150
channel_->InvokeMethod("viewFocused", std::move(id));
151151
}
152152

153-
result->Success(flutter::EncodableValue(viewInstance->getTextureId()));
153+
result->Success(flutter::EncodableValue(viewInstance->GetTextureId()));
154154
} else {
155155
LoggerE("can't find view type = %s", viewType.c_str());
156156
result->Error("0", "can't find view type");
157157
}
158158
} else {
159-
int viewId = extractIntFromMap(arguments, "id");
159+
int viewId = ExtractIntFromMap(arguments, "id");
160160
auto it = view_instances_.find(viewId);
161161
if (viewId >= 0 && it != view_instances_.end()) {
162162
if (method == "dispose") {
163163
LoggerD("PlatformViewChannel dispose");
164-
it->second->dispose();
164+
it->second->Dispose();
165165
result->Success();
166166
} else if (method == "resize") {
167167
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);
171171
result->NotImplemented();
172172
} else if (method == "touch") {
173173
int type, button;
174174
double x, y, dx, dy;
175175

176-
flutter::EncodableList event = extractListFromMap(arguments, "event");
176+
flutter::EncodableList event = ExtractListFromMap(arguments, "event");
177177
if (event.size() != 6) {
178178
result->Error("Invalid Arguments");
179179
return;
@@ -185,14 +185,14 @@ void PlatformViewChannel::HandleMethodCall(
185185
dx = std::get<double>(event[4]);
186186
dy = std::get<double>(event[5]);
187187

188-
it->second->touch(type, button, x, y, dx, dy);
188+
it->second->Touch(type, button, x, y, dx, dy);
189189
result->Success();
190190
} else if (method == "setDirection") {
191191
LoggerD("PlatformViewChannel setDirection");
192192
result->NotImplemented();
193193
} else if (method == "clearFocus") {
194194
LoggerD("PlatformViewChannel clearFocus");
195-
it->second->clearFocus();
195+
it->second->ClearFocus();
196196
result->NotImplemented();
197197
} else {
198198
LoggerD("Unimplemented method: %s", method.c_str());

shell/platform/tizen/channels/platform_view_channel.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class PlatformViewChannel {
1919
public:
2020
explicit PlatformViewChannel(flutter::BinaryMessenger* messenger);
2121
virtual ~PlatformViewChannel();
22-
std::map<std::string, std::unique_ptr<PlatformViewFactory>>& viewFactories() {
22+
std::map<std::string, std::unique_ptr<PlatformViewFactory>>& ViewFactories() {
2323
return view_factories_;
2424
}
25-
std::map<int, PlatformView*>& viewInstances() { return view_instances_; }
25+
std::map<int, PlatformView*>& ViewInstances() { return view_instances_; }
2626

27-
void sendKeyEvent(Ecore_Event_Key* key, bool is_down);
28-
int currentFocusedViewId();
27+
void SendKeyEvent(Ecore_Event_Key* key, bool is_down);
28+
int CurrentFocusedViewId();
2929

3030
private:
3131
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>> channel_;

shell/platform/tizen/channels/text_input_channel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TextInputChannel {
3131
void OnPredit(const char* str, int cursorPos);
3232
void ShowSoftwareKeyboard();
3333
void HideSoftwareKeyboard();
34-
bool isSoftwareKeyboardShowing() { return isSoftwareKeyboardShowing_; }
34+
bool IsSoftwareKeyboardShowing() { return isSoftwareKeyboardShowing_; }
3535
SoftwareKeyboardGeometry GetCurrentKeyboardGeometry() {
3636
return current_keyboard_geometry_;
3737
}

shell/platform/tizen/flutter_tizen.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
#include "public/flutter_tizen.h"
77

88
#include <inttypes.h>
9+
910
#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h"
10-
#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h"
1111
#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h"
12+
#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h"
1213
#include "flutter/shell/platform/tizen/logger.h"
14+
#include "flutter/shell/platform/tizen/public/flutter_platform_view.h"
1315
#include "flutter/shell/platform/tizen/public/flutter_texture_registrar.h"
1416
#include "flutter/shell/platform/tizen/tizen_embedder_engine.h"
15-
#include "flutter/shell/platform/tizen/public/flutter_platform_view.h"
1617

1718
// Opaque reference to a Tizen embedder engine.
1819
struct FlutterWindowControllerState {
@@ -266,7 +267,7 @@ bool FlutterMarkExternalTextureFrameAvailable(
266267
void FlutterRegisterViewFactory(
267268
FlutterDesktopPluginRegistrarRef registrar, const char* view_type,
268269
std::unique_ptr<PlatformViewFactory> view_factory) {
269-
registrar->engine->platform_view_channel->viewFactories().insert(
270+
registrar->engine->platform_view_channel->ViewFactories().insert(
270271
std::pair<std::string, std::unique_ptr<PlatformViewFactory>>(
271272
view_type, std::move(view_factory)));
272273
}

shell/platform/tizen/key_event_handler.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Eina_Bool KeyEventHandler::OnKey(void *data, int type, void *event) {
4040
if (is_down) {
4141
engine->text_input_channel->OnKeyDown(key);
4242
}
43-
if (engine->text_input_channel->isSoftwareKeyboardShowing()) {
43+
if (engine->text_input_channel->IsSoftwareKeyboardShowing()) {
4444
return ECORE_CALLBACK_PASS_ON;
4545
}
4646
}
4747
if (engine->key_event_channel) {
4848
engine->key_event_channel->SendKeyEvent(key, is_down);
4949
}
5050
if (engine->platform_view_channel) {
51-
engine->platform_view_channel->sendKeyEvent(key, is_down);
51+
engine->platform_view_channel->SendKeyEvent(key, is_down);
5252
}
5353
}
5454
return ECORE_CALLBACK_PASS_ON;

shell/platform/tizen/public/flutter_platform_view.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ class PlatformView {
2121
textureId_(0),
2222
isFocused_(false) {}
2323
virtual ~PlatformView() {}
24-
int getViewId() { return viewId_; }
25-
int getTextureId() { return textureId_; }
26-
void setTextureId(int textureId) { textureId_ = textureId; }
27-
flutter::PluginRegistrar* getPluginRegistrar() { return registrar_; }
28-
virtual void dispose() = 0;
29-
virtual void resize(double width, double height) = 0;
30-
virtual void touch(int type, int button, double x, double y, double dx,
24+
int GetViewId() { return viewId_; }
25+
int GetTextureId() { return textureId_; }
26+
void SetTextureId(int textureId) { textureId_ = textureId; }
27+
flutter::PluginRegistrar* GetPluginRegistrar() { return registrar_; }
28+
virtual void Dispose() = 0;
29+
virtual void Resize(double width, double height) = 0;
30+
virtual void Touch(int type, int button, double x, double y, double dx,
3131
double dy) = 0;
32-
virtual void setDirection(int direction) = 0;
33-
virtual void clearFocus() = 0;
34-
void setFocus(bool f) { isFocused_ = f; }
35-
bool isFocused() { return isFocused_; }
32+
virtual void SetDirection(int direction) = 0;
33+
virtual void ClearFocus() = 0;
34+
void SetFocus(bool f) { isFocused_ = f; }
35+
bool IsFocused() { return isFocused_; }
3636

3737
// Key input event
38-
virtual void dispatchKeyDownEvent(Ecore_Event_Key* key) = 0;
39-
virtual void dispatchKeyUpEvent(Ecore_Event_Key* key) = 0;
38+
virtual void DispatchKeyDownEvent(Ecore_Event_Key* key) = 0;
39+
virtual void DispatchKeyUpEvent(Ecore_Event_Key* key) = 0;
4040

4141
private:
4242
flutter::PluginRegistrar* registrar_;
@@ -51,13 +51,13 @@ class PlatformViewFactory {
5151
: registrar_(registrar),
5252
codec_(flutter::StandardMessageCodec::GetInstance(nullptr)) {}
5353
virtual ~PlatformViewFactory() {}
54-
flutter::PluginRegistrar* getPluginRegistrar() { return registrar_; }
55-
const flutter::MessageCodec<flutter::EncodableValue>& getCodec() {
54+
flutter::PluginRegistrar* GetPluginRegistrar() { return registrar_; }
55+
const flutter::MessageCodec<flutter::EncodableValue>& GetCodec() {
5656
return codec_;
5757
}
58-
virtual PlatformView* create(int viewId, double width, double height,
58+
virtual PlatformView* Create(int viewId, double width, double height,
5959
const ByteMessage& createParams) = 0;
60-
virtual void dispose() = 0;
60+
virtual void Dispose() = 0;
6161

6262
private:
6363
flutter::PluginRegistrar* registrar_;

shell/platform/tizen/tizen_embedder_engine.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void TizenEmbedderEngine::SetWindowOrientation(int32_t degree) {
269269
double width = geometry.w;
270270
double height = geometry.h;
271271

272-
if (text_input_channel->isSoftwareKeyboardShowing()) {
272+
if (text_input_channel->IsSoftwareKeyboardShowing()) {
273273
height -= text_input_channel->GetCurrentKeyboardGeometry().h;
274274
}
275275

0 commit comments

Comments
 (0)