forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fl_platform_channel.h
108 lines (91 loc) · 4.14 KB
/
fl_platform_channel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PLATFORM_CHANNEL_H_
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLATFORM_CHANNEL_H_
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_call.h"
G_BEGIN_DECLS
typedef enum {
FL_PLATFORM_CHANNEL_EXIT_TYPE_CANCELABLE,
FL_PLATFORM_CHANNEL_EXIT_TYPE_REQUIRED,
} FlPlatformChannelExitType;
typedef enum {
FL_PLATFORM_CHANNEL_EXIT_RESPONSE_CANCEL,
FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT,
} FlPlatformChannelExitResponse;
G_DECLARE_FINAL_TYPE(FlPlatformChannel,
fl_platform_channel,
FL,
PLATFORM_CHANNEL,
GObject);
/**
* FlPlatformChannel:
*
* #FlPlatformChannel is a channel that implements the shell side
* of SystemChannels.platform from the Flutter services library.
*/
typedef struct {
FlMethodResponse* (*clipboard_set_data)(FlMethodCall* method_call,
const gchar* text,
gpointer user_data);
FlMethodResponse* (*clipboard_get_data)(FlMethodCall* method_call,
const gchar* format,
gpointer user_data);
FlMethodResponse* (*clipboard_has_strings)(FlMethodCall* method_call,
gpointer user_data);
FlMethodResponse* (*system_exit_application)(FlMethodCall* method_call,
FlPlatformChannelExitType type,
gpointer user_data);
void (*system_initialization_complete)(gpointer user_data);
void (*system_sound_play)(const gchar* type, gpointer user_data);
void (*system_navigator_pop)(gpointer user_data);
} FlPlatformChannelVTable;
/**
* fl_platform_channel_new:
* @messenger: an #FlBinaryMessenger
* @vtable: callbacks for incoming method calls.
* @user_data: data to pass in callbacks.
*
* Creates a new channel that implements SystemChannels.platform from the
* Flutter services library.
*
* Returns: a new #FlPlatformChannel
*/
FlPlatformChannel* fl_platform_channel_new(FlBinaryMessenger* messenger,
FlPlatformChannelVTable* vtable,
gpointer user_data);
/**
* fl_platform_channel_system_request_app_exit:
* @channel: an #FlPlatformChannel
*
* Request the application exits (i.e. due to the window being requested to be
* closed).
*
* Calling this will only send an exit request to the framework if the framework
* has already indicated that it is ready to receive requests by sending a
* "System.initializationComplete" method call on the platform channel. Calls
* before initialization is complete will result in an immediate exit.
*/
void fl_platform_channel_system_request_app_exit(FlPlatformChannel* channel,
FlPlatformChannelExitType type,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean fl_platform_channel_system_request_app_exit_finish(
GObject* object,
GAsyncResult* result,
FlPlatformChannelExitResponse* exit_response,
GError** error);
void fl_platform_channel_respond_system_exit_application(
FlMethodCall* method_call,
FlPlatformChannelExitResponse exit_response);
void fl_platform_channel_respond_clipboard_get_data(FlMethodCall* method_call,
const gchar* text);
void fl_platform_channel_respond_clipboard_has_strings(
FlMethodCall* method_call,
gboolean has_strings);
FlMethodResponse* fl_platform_channel_make_system_request_app_exit_response(
FlPlatformChannelExitResponse exit_response);
G_END_DECLS
#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLATFORM_CHANNEL_H_