5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_VIEW_IOS_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_VIEW_IOS_H_
10 #include "flutter/fml/closure.h"
11 #include "flutter/fml/macros.h"
12 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
13 #include "flutter/fml/platform/darwin/weak_nsobject.h"
14 #include "flutter/shell/common/platform_view.h"
44 const std::shared_ptr<IOSContext>& context,
45 const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
46 const flutter::TaskRunners& task_runners);
49 PlatformView::Delegate& delegate,
51 const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
52 const flutter::TaskRunners& task_runners,
53 const std::shared_ptr<fml::ConcurrentTaskRunner>& worker_task_runner,
54 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch);
93 const std::shared_ptr<IOSContext>&
GetIosContext() {
return ios_context_; }
96 return platform_message_handler_;
100 return platform_message_handler_;
106 class ScopedObserver {
110 void reset(id<NSObject> observer);
111 ScopedObserver(
const ScopedObserver&) =
delete;
112 ScopedObserver& operator=(
const ScopedObserver&) =
delete;
115 id<NSObject> observer_ = nil;
120 class AccessibilityBridgeManager {
122 explicit AccessibilityBridgeManager(
const std::function<
void(
bool)>& set_semantics_enabled);
123 AccessibilityBridgeManager(
const std::function<
void(
bool)>& set_semantics_enabled,
124 AccessibilityBridge* bridge);
125 explicit operator bool() const noexcept {
return static_cast<bool>(accessibility_bridge_); }
126 AccessibilityBridge* get() const noexcept {
return accessibility_bridge_.get(); }
127 void Set(std::unique_ptr<AccessibilityBridge> bridge);
131 FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeManager);
132 std::unique_ptr<AccessibilityBridge> accessibility_bridge_;
133 std::function<void(
bool)> set_semantics_enabled_;
136 fml::WeakNSObject<FlutterViewController> owner_controller_;
139 std::mutex ios_surface_mutex_;
140 std::unique_ptr<IOSSurface> ios_surface_;
141 std::shared_ptr<IOSContext> ios_context_;
142 const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller_;
143 AccessibilityBridgeManager accessibility_bridge_;
144 fml::scoped_nsprotocol<FlutterTextInputPlugin*> text_input_plugin_;
145 ScopedObserver dealloc_view_controller_observer_;
146 std::vector<std::string> platform_resolved_locale_;
147 std::shared_ptr<PlatformMessageHandlerIos> platform_message_handler_;
150 void HandlePlatformMessage(std::unique_ptr<flutter::PlatformMessage> message)
override;
153 std::unique_ptr<Surface> CreateRenderingSurface()
override;
156 std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder()
override;
159 sk_sp<GrDirectContext> CreateResourceContext()
const override;
162 std::shared_ptr<impeller::Context> GetImpellerContext()
const override;
165 void SetAccessibilityFeatures(int32_t flags)
override;
168 void UpdateSemantics(flutter::SemanticsNodeUpdates update,
169 flutter::CustomAccessibilityActionUpdates actions)
override;
172 std::unique_ptr<VsyncWaiter> CreateVSyncWaiter()
override;
175 void OnPreEngineRestart()
const override;
178 std::unique_ptr<std::vector<std::string>> ComputePlatformResolvedLocales(
179 const std::vector<std::string>& supported_locale_data)
override;
186 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_VIEW_IOS_H_