Flutter Linux Embedder
fl_platform_channel.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_LINUX_FL_PLATFORM_CHANNEL_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLATFORM_CHANNEL_H_
7 
10 
11 G_BEGIN_DECLS
12 
13 typedef enum {
17 
18 typedef enum {
22 
23 G_DECLARE_FINAL_TYPE(FlPlatformChannel,
24  fl_platform_channel,
25  FL,
26  PLATFORM_CHANNEL,
27  GObject);
28 
29 /**
30  * FlPlatformChannel:
31  *
32  * #FlPlatformChannel is a channel that implements the shell side
33  * of SystemChannels.platform from the Flutter services library.
34  */
35 
36 typedef struct {
37  FlMethodResponse* (*clipboard_set_data)(FlMethodCall* method_call,
38  const gchar* text,
39  gpointer user_data);
40  FlMethodResponse* (*clipboard_get_data)(FlMethodCall* method_call,
41  const gchar* format,
42  gpointer user_data);
43  FlMethodResponse* (*clipboard_has_strings)(FlMethodCall* method_call,
44  gpointer user_data);
45  FlMethodResponse* (*system_exit_application)(FlMethodCall* method_call,
47  gpointer user_data);
49  void (*system_sound_play)(const gchar* type, gpointer user_data);
50  void (*system_navigator_pop)(gpointer user_data);
52 
53 /**
54  * fl_platform_channel_new:
55  * @messenger: an #FlBinaryMessenger
56  * @vtable: callbacks for incoming method calls.
57  * @user_data: data to pass in callbacks.
58  *
59  * Creates a new channel that implements SystemChannels.platform from the
60  * Flutter services library.
61  *
62  * Returns: a new #FlPlatformChannel
63  */
64 FlPlatformChannel* fl_platform_channel_new(FlBinaryMessenger* messenger,
66  gpointer user_data);
67 
68 /**
69  * fl_platform_channel_system_request_app_exit:
70  * @channel: an #FlPlatformChannel
71  *
72  * Request the application exits (i.e. due to the window being requested to be
73  * closed).
74  *
75  * Calling this will only send an exit request to the framework if the framework
76  * has already indicated that it is ready to receive requests by sending a
77  * "System.initializationComplete" method call on the platform channel. Calls
78  * before initialization is complete will result in an immediate exit.
79  */
80 void fl_platform_channel_system_request_app_exit(FlPlatformChannel* channel,
82  GCancellable* cancellable,
83  GAsyncReadyCallback callback,
84  gpointer user_data);
85 
87  GObject* object,
88  GAsyncResult* result,
89  FlPlatformChannelExitResponse* exit_response,
90  GError** error);
91 
93  FlMethodCall* method_call,
94  FlPlatformChannelExitResponse exit_response);
95 
97  const gchar* text);
98 
100  FlMethodCall* method_call,
101  gboolean has_strings);
102 
104  FlPlatformChannelExitResponse exit_response);
105 
106 G_END_DECLS
107 
108 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLATFORM_CHANNEL_H_
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1115
FlPlatformChannelExitResponse
FlPlatformChannelExitResponse
Definition: fl_platform_channel.h:18
fl_platform_channel_new
FlPlatformChannel * fl_platform_channel_new(FlBinaryMessenger *messenger, FlPlatformChannelVTable *vtable, gpointer user_data)
Definition: fl_platform_channel.cc:222
fl_platform_channel_system_request_app_exit_finish
gboolean fl_platform_channel_system_request_app_exit_finish(GObject *object, GAsyncResult *result, FlPlatformChannelExitResponse *exit_response, GError **error)
Definition: fl_platform_channel.cc:268
fl_platform_channel_system_request_app_exit
void fl_platform_channel_system_request_app_exit(FlPlatformChannel *channel, FlPlatformChannelExitType type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_platform_channel.cc:243
fl_platform_channel_make_system_request_app_exit_response
FlMethodResponse * fl_platform_channel_make_system_request_app_exit_response(FlPlatformChannelExitResponse exit_response)
Definition: fl_platform_channel.cc:330
FL_PLATFORM_CHANNEL_EXIT_RESPONSE_CANCEL
@ FL_PLATFORM_CHANNEL_EXIT_RESPONSE_CANCEL
Definition: fl_platform_channel.h:19
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
fl_binary_messenger.h
FlPlatformChannelExitType
FlPlatformChannelExitType
Definition: fl_platform_channel.h:13
fl_method_call.h
fl_platform_channel_respond_clipboard_has_strings
void fl_platform_channel_respond_clipboard_has_strings(FlMethodCall *method_call, gboolean has_strings)
Definition: fl_platform_channel.cc:302
FL
FL
Definition: fl_binary_messenger.cc:27
FL_PLATFORM_CHANNEL_EXIT_TYPE_CANCELABLE
@ FL_PLATFORM_CHANNEL_EXIT_TYPE_CANCELABLE
Definition: fl_platform_channel.h:14
FlPlatformChannelVTable
Definition: fl_platform_channel.h:36
FL_PLATFORM_CHANNEL_EXIT_TYPE_REQUIRED
@ FL_PLATFORM_CHANNEL_EXIT_TYPE_REQUIRED
Definition: fl_platform_channel.h:15
system_sound_play
static FlMethodResponse * system_sound_play(FlPlatformChannel *self, FlValue *args)
Definition: fl_platform_channel.cc:155
system_navigator_pop
static FlMethodResponse * system_navigator_pop(FlPlatformChannel *self)
Definition: fl_platform_channel.cc:168
FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT
@ FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT
Definition: fl_platform_channel.h:20
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_platform_channel_respond_system_exit_application
void fl_platform_channel_respond_system_exit_application(FlMethodCall *method_call, FlPlatformChannelExitResponse exit_response)
Definition: fl_platform_channel.cc:318
G_DECLARE_FINAL_TYPE
G_DECLARE_FINAL_TYPE(FlPlatformChannel, fl_platform_channel, FL, PLATFORM_CHANNEL, GObject)
system_initialization_complete
static FlMethodResponse * system_initialization_complete(FlPlatformChannel *self)
Definition: fl_platform_channel.cc:149
format
uint32_t uint32_t * format
Definition: fl_texture_registrar_test.cc:42
fl_platform_channel_respond_clipboard_get_data
void fl_platform_channel_respond_clipboard_get_data(FlMethodCall *method_call, const gchar *text)
Definition: fl_platform_channel.cc:284