Skip to content

Commit 85c27d0

Browse files
committed
Use the flutter namespace (#121)
* Remove engine dependency of LifecycleChannel * Minor formatting * Organize headers * Use the flutter namespace * Revert "Remove engine dependency of LifecycleChannel" This reverts commit a45473d.
1 parent a792ed9 commit 85c27d0

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

+423
-208
lines changed

shell/platform/tizen/channels/key_event_channel.cc

+27-20
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,29 @@
88

99
#include "flutter/shell/platform/tizen/tizen_log.h"
1010

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

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

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

2630
// Mapping from physical (xkb) to logical (GTK) key codes.
2731
// The values are defined in:
2832
// - flutter/keyboard_maps.dart (kLinuxToPhysicalKey, kGtkToLogicalKey)
29-
static const std::map<int, int> kKeyCodeMap = {
33+
const std::map<int, int> kKeyCodeMap = {
3034
{0x00000009, 65307}, // LogicalKeyboardKey.escape
3135
{0x0000000a, 49}, // LogicalKeyboardKey.digit1
3236
{0x0000000b, 50}, // LogicalKeyboardKey.digit2
@@ -202,7 +206,7 @@ static const std::map<int, int> kKeyCodeMap = {
202206
// The values are defined in:
203207
// - efl/Ecore_Input.h
204208
// - flutter/raw_keyboard_linux.dart (GtkKeyHelper)
205-
static const std::map<int, int> kModifierMap = {
209+
const std::map<int, int> kModifierMap = {
206210
{0x0001, 1 << 0}, // SHIFT (modifierShift)
207211
{0x0002, 1 << 2}, // CTRL (modifierControl)
208212
{0x0004, 1 << 3}, // ALT (modifierMod1)
@@ -212,12 +216,13 @@ static const std::map<int, int> kModifierMap = {
212216
{0x0040, 1 << 1}, // CAPS (modifierCapsLock)
213217
};
214218

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

222227
KeyEventChannel::~KeyEventChannel() {}
223228

@@ -251,3 +256,5 @@ void KeyEventChannel::SendKeyEvent(Ecore_Event_Key* key, bool is_down) {
251256
}
252257
channel_->Send(event);
253258
}
259+
260+
} // namespace flutter

shell/platform/tizen/channels/key_event_channel.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77

88
#include <Ecore_Input.h>
99

10+
#include <memory>
11+
1012
#include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h"
1113
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
1214
#include "flutter/shell/platform/common/json_message_codec.h"
1315
#include "rapidjson/document.h"
1416

17+
namespace flutter {
18+
1519
class KeyEventChannel {
1620
public:
17-
explicit KeyEventChannel(flutter::BinaryMessenger* messenger);
21+
explicit KeyEventChannel(BinaryMessenger* messenger);
1822
virtual ~KeyEventChannel();
1923

2024
void SendKeyEvent(Ecore_Event_Key* key, bool is_down);
2125

2226
private:
23-
std::unique_ptr<flutter::BasicMessageChannel<rapidjson::Document>> channel_;
27+
std::unique_ptr<BasicMessageChannel<rapidjson::Document>> channel_;
2428
};
2529

30+
} // namespace flutter
31+
2632
#endif // EMBEDDER_KEY_EVENT_CHANNEL_H_

shell/platform/tizen/channels/lifecycle_channel.cc

+14-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
88
#include "flutter/shell/platform/tizen/tizen_log.h"
99

10-
static constexpr char kChannelName[] = "flutter/lifecycle";
11-
static constexpr char kInactive[] = "AppLifecycleState.inactive";
12-
static constexpr char kResumed[] = "AppLifecycleState.resumed";
13-
static constexpr char kPaused[] = "AppLifecycleState.paused";
14-
static constexpr char kDetached[] = "AppLifecycleState.detached";
10+
namespace flutter {
11+
12+
namespace {
13+
14+
constexpr char kChannelName[] = "flutter/lifecycle";
15+
16+
constexpr char kInactive[] = "AppLifecycleState.inactive";
17+
constexpr char kResumed[] = "AppLifecycleState.resumed";
18+
constexpr char kPaused[] = "AppLifecycleState.paused";
19+
constexpr char kDetached[] = "AppLifecycleState.detached";
20+
21+
} // namespace
1522

1623
LifecycleChannel::LifecycleChannel(FlutterTizenEngine* engine)
1724
: engine_(engine) {}
@@ -43,3 +50,5 @@ void LifecycleChannel::AppIsDetached() {
4350
FT_LOGI("send app lifecycle state detached.");
4451
SendLifecycleMessage(kDetached);
4552
}
53+
54+
} // namespace flutter

shell/platform/tizen/channels/lifecycle_channel.h

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef EMBEDDER_LIFECYCLE_CHANNEL_H_
66
#define EMBEDDER_LIFECYCLE_CHANNEL_H_
77

8+
namespace flutter {
9+
810
class FlutterTizenEngine;
911

1012
class LifecycleChannel {
@@ -22,4 +24,6 @@ class LifecycleChannel {
2224
FlutterTizenEngine* engine_{nullptr};
2325
};
2426

27+
} // namespace flutter
28+
2529
#endif // EMBEDDER_LIFECYCLE_CHANNEL_H_

shell/platform/tizen/channels/localization_channel.cc

+4
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

+4
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

+15-7
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

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,28 @@
55
#ifndef EMBEDDER_NAVIGATION_CHANNEL_H_
66
#define EMBEDDER_NAVIGATION_CHANNEL_H_
77

8+
#include <memory>
9+
#include <string>
10+
811
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
912
#include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h"
1013
#include "rapidjson/document.h"
1114

15+
namespace flutter {
16+
1217
class NavigationChannel {
1318
public:
14-
explicit NavigationChannel(flutter::BinaryMessenger* messenger);
19+
explicit NavigationChannel(BinaryMessenger* messenger);
1520
virtual ~NavigationChannel();
1621

1722
void SetInitialRoute(const std::string& initialRoute);
1823
void PushRoute(const std::string& route);
1924
void PopRoute();
2025

2126
private:
22-
std::unique_ptr<flutter::MethodChannel<rapidjson::Document>> channel_;
27+
std::unique_ptr<MethodChannel<rapidjson::Document>> channel_;
2328
};
2429

25-
#endif // EMBEDDER_NAVIGATION_CHANNEL_H_
30+
} // namespace flutter
31+
32+
#endif // EMBEDDER_NAVIGATION_CHANNEL_H_

0 commit comments

Comments
 (0)