Skip to content

Commit 4424ad4

Browse files
committed
Use the flutter namespace
1 parent 2ca0325 commit 4424ad4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+410
-215
lines changed

shell/platform/tizen/channels/key_event_channel.cc

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,29 @@
99
#include "flutter/shell/platform/common/json_message_codec.h"
1010
#include "flutter/shell/platform/tizen/tizen_log.h"
1111

12-
static constexpr char kChannelName[] = "flutter/keyevent";
12+
namespace flutter {
1313

14-
static constexpr char kKeyMapKey[] = "keymap";
15-
static constexpr char kKeyCodeKey[] = "keyCode";
16-
static constexpr char kScanCodeKey[] = "scanCode";
17-
static constexpr char kTypeKey[] = "type";
18-
static constexpr char kModifiersKey[] = "modifiers";
19-
static constexpr char kToolkitKey[] = "toolkit";
20-
static constexpr char kUnicodeScalarValuesKey[] = "unicodeScalarValues";
14+
namespace {
2115

22-
static constexpr char kKeyUp[] = "keyup";
23-
static constexpr char kKeyDown[] = "keydown";
24-
static constexpr char kGtkToolkit[] = "gtk";
25-
static constexpr char kLinuxKeyMap[] = "linux";
16+
constexpr char kChannelName[] = "flutter/keyevent";
17+
18+
constexpr char kKeyMapKey[] = "keymap";
19+
constexpr char kKeyCodeKey[] = "keyCode";
20+
constexpr char kScanCodeKey[] = "scanCode";
21+
constexpr char kTypeKey[] = "type";
22+
constexpr char kModifiersKey[] = "modifiers";
23+
constexpr char kToolkitKey[] = "toolkit";
24+
constexpr char kUnicodeScalarValuesKey[] = "unicodeScalarValues";
25+
26+
constexpr char kKeyUp[] = "keyup";
27+
constexpr char kKeyDown[] = "keydown";
28+
constexpr char kGtkToolkit[] = "gtk";
29+
constexpr char kLinuxKeyMap[] = "linux";
2630

2731
// Mapping from physical (xkb) to logical (GTK) key codes.
2832
// The values are defined in:
2933
// - flutter/keyboard_maps.dart (kLinuxToPhysicalKey, kGtkToLogicalKey)
30-
static const std::map<int, int> kKeyCodeMap = {
34+
const std::map<int, int> kKeyCodeMap = {
3135
{0x00000009, 65307}, // LogicalKeyboardKey.escape
3236
{0x0000000a, 49}, // LogicalKeyboardKey.digit1
3337
{0x0000000b, 50}, // LogicalKeyboardKey.digit2
@@ -203,7 +207,7 @@ static const std::map<int, int> kKeyCodeMap = {
203207
// The values are defined in:
204208
// - efl/Ecore_Input.h
205209
// - flutter/raw_keyboard_linux.dart (GtkKeyHelper)
206-
static const std::map<int, int> kModifierMap = {
210+
const std::map<int, int> kModifierMap = {
207211
{0x0001, 1 << 0}, // SHIFT (modifierShift)
208212
{0x0002, 1 << 2}, // CTRL (modifierControl)
209213
{0x0004, 1 << 3}, // ALT (modifierMod1)
@@ -213,12 +217,13 @@ static const std::map<int, int> kModifierMap = {
213217
{0x0040, 1 << 1}, // CAPS (modifierCapsLock)
214218
};
215219

216-
KeyEventChannel::KeyEventChannel(flutter::BinaryMessenger* messenger)
217-
: channel_(
218-
std::make_unique<flutter::BasicMessageChannel<rapidjson::Document>>(
219-
messenger,
220-
kChannelName,
221-
&flutter::JsonMessageCodec::GetInstance())) {}
220+
} // namespace
221+
222+
KeyEventChannel::KeyEventChannel(BinaryMessenger* messenger)
223+
: channel_(std::make_unique<BasicMessageChannel<rapidjson::Document>>(
224+
messenger,
225+
kChannelName,
226+
&JsonMessageCodec::GetInstance())) {}
222227

223228
KeyEventChannel::~KeyEventChannel() {}
224229

@@ -252,3 +257,5 @@ void KeyEventChannel::SendKeyEvent(Ecore_Event_Key* key, bool is_down) {
252257
}
253258
channel_->Send(event);
254259
}
260+
261+
} // namespace flutter

shell/platform/tizen/channels/key_event_channel.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
1414
#include "rapidjson/document.h"
1515

16+
namespace flutter {
17+
1618
class KeyEventChannel {
1719
public:
18-
explicit KeyEventChannel(flutter::BinaryMessenger* messenger);
20+
explicit KeyEventChannel(BinaryMessenger* messenger);
1921
virtual ~KeyEventChannel();
2022

2123
void SendKeyEvent(Ecore_Event_Key* key, bool is_down);
2224

2325
private:
24-
std::unique_ptr<flutter::BasicMessageChannel<rapidjson::Document>> channel_;
26+
std::unique_ptr<BasicMessageChannel<rapidjson::Document>> channel_;
2527
};
2628

29+
} // namespace flutter
30+
2731
#endif // EMBEDDER_KEY_EVENT_CHANNEL_H_

shell/platform/tizen/channels/lifecycle_channel.cc

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,45 @@
88
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
99
#include "flutter/shell/platform/tizen/tizen_log.h"
1010

11-
static constexpr char kChannelName[] = "flutter/lifecycle";
12-
static constexpr char kInactive[] = "AppLifecycleState.inactive";
13-
static constexpr char kResumed[] = "AppLifecycleState.resumed";
14-
static constexpr char kPaused[] = "AppLifecycleState.paused";
15-
static constexpr char kDetached[] = "AppLifecycleState.detached";
16-
17-
LifecycleChannel::LifecycleChannel(flutter::BinaryMessenger* messenger)
18-
: channel_(std::make_unique<
19-
flutter::BasicMessageChannel<flutter::EncodableValue>>(
11+
namespace flutter {
12+
13+
namespace {
14+
15+
constexpr char kChannelName[] = "flutter/lifecycle";
16+
17+
constexpr char kInactive[] = "AppLifecycleState.inactive";
18+
constexpr char kResumed[] = "AppLifecycleState.resumed";
19+
constexpr char kPaused[] = "AppLifecycleState.paused";
20+
constexpr char kDetached[] = "AppLifecycleState.detached";
21+
22+
} // namespace
23+
24+
LifecycleChannel::LifecycleChannel(BinaryMessenger* messenger)
25+
: channel_(std::make_unique<BasicMessageChannel<EncodableValue>>(
2026
messenger,
2127
kChannelName,
22-
&flutter::StandardMessageCodec::GetInstance())) {}
28+
&StandardMessageCodec::GetInstance())) {}
2329

2430
LifecycleChannel::~LifecycleChannel() {}
2531

2632
void LifecycleChannel::AppIsInactive() {
2733
FT_LOGI("Sending %s message.", kInactive);
28-
channel_->Send(flutter::EncodableValue(kInactive));
34+
channel_->Send(EncodableValue(kInactive));
2935
}
3036

3137
void LifecycleChannel::AppIsResumed() {
3238
FT_LOGI("Sending %s message.", kResumed);
33-
channel_->Send(flutter::EncodableValue(kResumed));
39+
channel_->Send(EncodableValue(kResumed));
3440
}
3541

3642
void LifecycleChannel::AppIsPaused() {
3743
FT_LOGI("Sending %s message.", kPaused);
38-
channel_->Send(flutter::EncodableValue(kPaused));
44+
channel_->Send(EncodableValue(kPaused));
3945
}
4046

4147
void LifecycleChannel::AppIsDetached() {
4248
FT_LOGI("Sending %s message.", kDetached);
43-
channel_->Send(flutter::EncodableValue(kDetached));
49+
channel_->Send(EncodableValue(kDetached));
4450
}
51+
52+
} // namespace flutter

shell/platform/tizen/channels/lifecycle_channel.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
#include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h"
1111
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
1212

13+
namespace flutter {
14+
1315
class LifecycleChannel {
1416
public:
15-
explicit LifecycleChannel(flutter::BinaryMessenger* messenger);
17+
explicit LifecycleChannel(BinaryMessenger* messenger);
1618
virtual ~LifecycleChannel();
1719

1820
void AppIsInactive();
@@ -21,8 +23,9 @@ class LifecycleChannel {
2123
void AppIsDetached();
2224

2325
private:
24-
std::unique_ptr<flutter::BasicMessageChannel<flutter::EncodableValue>>
25-
channel_;
26+
std::unique_ptr<BasicMessageChannel<EncodableValue>> channel_;
2627
};
2728

29+
} // namespace flutter
30+
2831
#endif // EMBEDDER_LIFECYCLE_CHANNEL_H_

shell/platform/tizen/channels/localization_channel.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
static constexpr char kChannelName[] = "flutter/localization";
1616

17+
namespace flutter {
18+
1719
LocalizationChannel::LocalizationChannel(FlutterTizenEngine* engine)
1820
: engine_(engine) {}
1921

@@ -197,3 +199,5 @@ void LocalizationChannel::DestroyFlutterLocale(FlutterLocale* flutter_locale) {
197199
flutter_locale = nullptr;
198200
}
199201
}
202+
203+
} // namespace flutter

shell/platform/tizen/channels/localization_channel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "flutter/shell/platform/embedder/embedder.h"
99

10+
namespace flutter {
11+
1012
class FlutterTizenEngine;
1113

1214
class LocalizationChannel {
@@ -24,4 +26,6 @@ class LocalizationChannel {
2426
FlutterTizenEngine* engine_;
2527
};
2628

29+
} // namespace flutter
30+
2731
#endif // EMBEDDER_LOCALIZATION_CHANNEL_H_

shell/platform/tizen/channels/navigation_channel.cc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66

77
#include "flutter/shell/platform/common/json_method_codec.h"
88

9-
static constexpr char kChannelName[] = "flutter/navigation";
9+
namespace flutter {
1010

11-
static constexpr char kSetInitialRouteMethod[] = "setInitialRoute";
12-
static constexpr char kPushRouteMethod[] = "pushRoute";
13-
static constexpr char kPopRouteMethod[] = "popRoute";
11+
namespace {
1412

15-
NavigationChannel::NavigationChannel(flutter::BinaryMessenger* messenger)
16-
: channel_(std::make_unique<flutter::MethodChannel<rapidjson::Document>>(
13+
constexpr char kChannelName[] = "flutter/navigation";
14+
15+
constexpr char kSetInitialRouteMethod[] = "setInitialRoute";
16+
constexpr char kPushRouteMethod[] = "pushRoute";
17+
constexpr char kPopRouteMethod[] = "popRoute";
18+
19+
} // namespace
20+
21+
NavigationChannel::NavigationChannel(BinaryMessenger* messenger)
22+
: channel_(std::make_unique<MethodChannel<rapidjson::Document>>(
1723
messenger,
1824
kChannelName,
19-
&flutter::JsonMethodCodec::GetInstance())) {}
25+
&JsonMethodCodec::GetInstance())) {}
2026

2127
NavigationChannel::~NavigationChannel() {}
2228

@@ -41,3 +47,5 @@ void NavigationChannel::PushRoute(const std::string& route) {
4147
void NavigationChannel::PopRoute() {
4248
channel_->InvokeMethod(kPopRouteMethod, nullptr);
4349
}
50+
51+
} // namespace flutter

shell/platform/tizen/channels/navigation_channel.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@
1212
#include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h"
1313
#include "rapidjson/document.h"
1414

15+
namespace flutter {
16+
1517
class NavigationChannel {
1618
public:
17-
explicit NavigationChannel(flutter::BinaryMessenger* messenger);
19+
explicit NavigationChannel(BinaryMessenger* messenger);
1820
virtual ~NavigationChannel();
1921

2022
void SetInitialRoute(const std::string& initialRoute);
2123
void PushRoute(const std::string& route);
2224
void PopRoute();
2325

2426
private:
25-
std::unique_ptr<flutter::MethodChannel<rapidjson::Document>> channel_;
27+
std::unique_ptr<MethodChannel<rapidjson::Document>> channel_;
2628
};
2729

30+
} // namespace flutter
31+
2832
#endif // EMBEDDER_NAVIGATION_CHANNEL_H_

0 commit comments

Comments
 (0)