Flutter Engine
platform_view_embedder.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_
6 #define FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_
7 
8 #include <functional>
9 
10 #include "flow/embedded_views.h"
11 #include "flutter/fml/macros.h"
12 #include "flutter/shell/common/platform_view.h"
13 #include "flutter/shell/platform/embedder/embedder.h"
14 #include "flutter/shell/platform/embedder/embedder_surface.h"
15 #include "flutter/shell/platform/embedder/embedder_surface_software.h"
16 #include "flutter/shell/platform/embedder/vsync_waiter_embedder.h"
17 
18 #ifdef SHELL_ENABLE_GL
19 #include "flutter/shell/platform/embedder/embedder_surface_gl.h"
20 #endif
21 
22 namespace flutter {
23 
24 class PlatformViewEmbedder final : public PlatformView {
25  public:
27  std::function<void(flutter::SemanticsNodeUpdates update)>;
29  std::function<void(flutter::CustomAccessibilityActionUpdates actions)>;
31  std::function<void(fml::RefPtr<flutter::PlatformMessage>)>;
33  std::function<std::unique_ptr<std::vector<std::string>>(
34  const std::vector<std::string>& supported_locale_data)>;
35 
45  };
46 
47  // Create a platform view that sets up a software rasterizer.
49  PlatformView::Delegate& delegate,
50  flutter::TaskRunners task_runners,
51  EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table,
52  PlatformDispatchTable platform_dispatch_table,
53  std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder);
54 
55 #ifdef SHELL_ENABLE_GL
56  // Creates a platform view that sets up an OpenGL rasterizer.
58  PlatformView::Delegate& delegate,
59  flutter::TaskRunners task_runners,
60  EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table,
61  bool fbo_reset_after_present,
62  PlatformDispatchTable platform_dispatch_table,
63  std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder);
64 #endif
65 
66  ~PlatformViewEmbedder() override;
67 
68  // |PlatformView|
69  void UpdateSemantics(
72 
73  // |PlatformView|
75  fml::RefPtr<flutter::PlatformMessage> message) override;
76 
77  private:
78  std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder_;
79  std::unique_ptr<EmbedderSurface> embedder_surface_;
80  PlatformDispatchTable platform_dispatch_table_;
81 
82  // |PlatformView|
83  std::unique_ptr<Surface> CreateRenderingSurface() override;
84 
85  // |PlatformView|
86  sk_sp<GrDirectContext> CreateResourceContext() const override;
87 
88  // |PlatformView|
89  std::unique_ptr<VsyncWaiter> CreateVSyncWaiter() override;
90 
91  // |PlatformView|
92  std::unique_ptr<std::vector<std::string>> ComputePlatformResolvedLocales(
93  const std::vector<std::string>& supported_locale_data) override;
94 
96 };
97 
98 } // namespace flutter
99 
100 #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_
ComputePlatformResolvedLocaleCallback compute_platform_resolved_locale_callback
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
Platform views are created by the shell on the platform task runner. Unless explicitly specified...
Definition: platform_view.h:44
void UpdateSemantics(flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) override
Used by the framework to tell the embedder to apply the specified semantics node updates. The default implementation of this method does nothing.
PlatformMessageResponseCallback platform_message_response_callback
PlatformViewEmbedder(PlatformView::Delegate &delegate, flutter::TaskRunners task_runners, EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table, PlatformDispatchTable platform_dispatch_table, std::shared_ptr< EmbedderExternalViewEmbedder > external_view_embedder)
UpdateSemanticsCustomActionsCallback update_semantics_custom_actions_callback
std::function< void(flutter::CustomAccessibilityActionUpdates actions)> UpdateSemanticsCustomActionsCallback
std::function< void(fml::RefPtr< flutter::PlatformMessage >)> PlatformMessageResponseCallback
std::function< void(flutter::SemanticsNodeUpdates update)> UpdateSemanticsNodesCallback
std::function< void(intptr_t)> VsyncCallback
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
Used to forward events from the platform view to interested subsystems. This forwarding is done by th...
Definition: platform_view.h:51
std::function< std::unique_ptr< std::vector< std::string > >(const std::vector< std::string > &supported_locale_data)> ComputePlatformResolvedLocaleCallback
void HandlePlatformMessage(fml::RefPtr< flutter::PlatformMessage > message) override
Overridden by embedders to perform actions in response to platform messages sent from the framework t...