#include <platform_handler.h>
|
virtual void | GetPlainText (std::unique_ptr< MethodResult< rapidjson::Document >> result, std::string_view key) |
|
virtual void | GetHasStrings (std::unique_ptr< MethodResult< rapidjson::Document >> result) |
|
virtual void | SetPlainText (const std::string &text, std::unique_ptr< MethodResult< rapidjson::Document >> result) |
|
virtual void | SystemSoundPlay (const std::string &sound_type, std::unique_ptr< MethodResult< rapidjson::Document >> result) |
|
virtual void | SystemExitApplication (AppExitType exit_type, UINT exit_code, std::unique_ptr< MethodResult< rapidjson::Document >> result) |
|
virtual void | QuitApplication (std::optional< HWND > hwnd, std::optional< WPARAM > wparam, std::optional< LPARAM > lparam, UINT exit_code) |
|
virtual void | RequestAppExitSuccess (std::optional< HWND > hwnd, std::optional< WPARAM > wparam, std::optional< LPARAM > lparam, const rapidjson::Document *result, UINT exit_code) |
|
Definition at line 33 of file platform_handler.h.
◆ PlatformHandler()
Definition at line 222 of file platform_handler.cc.
227 : channel_(std::make_unique<MethodChannel<rapidjson::Document>>(
232 channel_->SetMethodCallHandler(
233 [
this](
const MethodCall<rapidjson::Document>& call,
234 std::unique_ptr<MethodResult<rapidjson::Document>> result) {
235 HandleMethodCall(call, std::move(result));
237 if (scoped_clipboard_provider.has_value()) {
238 scoped_clipboard_provider_ = scoped_clipboard_provider.value();
240 scoped_clipboard_provider_ = []() {
241 return std::make_unique<ScopedClipboard>();
◆ ~PlatformHandler()
flutter::PlatformHandler::~PlatformHandler |
( |
| ) |
|
|
virtualdefault |
◆ GetHasStrings()
void flutter::PlatformHandler::GetHasStrings |
( |
std::unique_ptr< MethodResult< rapidjson::Document >> |
result | ) |
|
|
protectedvirtual |
Definition at line 294 of file platform_handler.cc.
299 if (view ==
nullptr) {
301 "Clipboard is not available in Windows headless mode");
305 std::unique_ptr<ScopedClipboardInterface> clipboard =
306 scoped_clipboard_provider_();
309 int open_result = clipboard->Open(view->GetWindowHandle());
315 rapidjson::Document error_code;
316 error_code.SetInt(open_result);
317 result->Error(
kClipboardError,
"Unable to open clipboard", error_code);
322 hasStrings = clipboard->HasString();
325 rapidjson::Document document;
326 document.SetObject();
327 rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
328 document.AddMember(rapidjson::Value(
kValueKey, allocator),
329 rapidjson::Value(hasStrings), allocator);
330 result->Success(document);
References flutter::FlutterWindowsView::GetWindowHandle(), kAccessDeniedErrorCode, kClipboardError, kErrorSuccess, flutter::kImplicitViewId, kValueKey, and flutter::FlutterWindowsEngine::view().
◆ GetPlainText()
void flutter::PlatformHandler::GetPlainText |
( |
std::unique_ptr< MethodResult< rapidjson::Document >> |
result, |
|
|
std::string_view |
key |
|
) |
| |
|
protectedvirtual |
Definition at line 248 of file platform_handler.cc.
254 if (view ==
nullptr) {
256 "Clipboard is not available in Windows headless mode");
260 std::unique_ptr<ScopedClipboardInterface> clipboard =
261 scoped_clipboard_provider_();
263 int open_result = clipboard->Open(view->GetWindowHandle());
265 rapidjson::Document error_code;
266 error_code.SetInt(open_result);
267 result->Error(
kClipboardError,
"Unable to open clipboard", error_code);
270 if (!clipboard->HasString()) {
271 result->Success(rapidjson::Document());
274 std::variant<std::wstring, int> get_string_result = clipboard->GetString();
275 if (std::holds_alternative<int>(get_string_result)) {
276 rapidjson::Document error_code;
277 error_code.SetInt(std::get<int>(get_string_result));
278 result->Error(
kClipboardError,
"Unable to get clipboard data", error_code);
282 rapidjson::Document document;
283 document.SetObject();
284 rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
286 rapidjson::Value(
key.data(), allocator),
288 fml::WideStringToUtf8(std::get<std::wstring>(get_string_result)),
291 result->Success(document);
References flutter::FlutterWindowsView::GetWindowHandle(), kClipboardError, kErrorSuccess, key, flutter::kImplicitViewId, and flutter::FlutterWindowsEngine::view().
◆ QuitApplication()
void flutter::PlatformHandler::QuitApplication |
( |
std::optional< HWND > |
hwnd, |
|
|
std::optional< WPARAM > |
wparam, |
|
|
std::optional< LPARAM > |
lparam, |
|
|
UINT |
exit_code |
|
) |
| |
|
protectedvirtual |
◆ RequestAppExit()
void flutter::PlatformHandler::RequestAppExit |
( |
std::optional< HWND > |
hwnd, |
|
|
std::optional< WPARAM > |
wparam, |
|
|
std::optional< LPARAM > |
lparam, |
|
|
AppExitType |
exit_type, |
|
|
UINT |
exit_code |
|
) |
| |
|
virtual |
◆ RequestAppExitSuccess()
void flutter::PlatformHandler::RequestAppExitSuccess |
( |
std::optional< HWND > |
hwnd, |
|
|
std::optional< WPARAM > |
wparam, |
|
|
std::optional< LPARAM > |
lparam, |
|
|
const rapidjson::Document * |
result, |
|
|
UINT |
exit_code |
|
) |
| |
|
protectedvirtual |
◆ SetPlainText()
void flutter::PlatformHandler::SetPlainText |
( |
const std::string & |
text, |
|
|
std::unique_ptr< MethodResult< rapidjson::Document >> |
result |
|
) |
| |
|
protectedvirtual |
◆ SystemExitApplication()
void flutter::PlatformHandler::SystemExitApplication |
( |
AppExitType |
exit_type, |
|
|
UINT |
exit_code, |
|
|
std::unique_ptr< MethodResult< rapidjson::Document >> |
result |
|
) |
| |
|
protectedvirtual |
◆ SystemSoundPlay()
void flutter::PlatformHandler::SystemSoundPlay |
( |
const std::string & |
sound_type, |
|
|
std::unique_ptr< MethodResult< rapidjson::Document >> |
result |
|
) |
| |
|
protectedvirtual |
◆ kClipboardError
constexpr char flutter::PlatformHandler::kClipboardError[] = "Clipboard error" |
|
staticconstexprprotected |
◆ kExitTypeCancelable
constexpr char flutter::PlatformHandler::kExitTypeCancelable[] = "cancelable" |
|
staticconstexpr |
◆ kExitTypeRequired
constexpr char flutter::PlatformHandler::kExitTypeRequired[] = "required" |
|
staticconstexpr |
◆ kSoundTypeAlert
constexpr char flutter::PlatformHandler::kSoundTypeAlert[] = "SystemSoundType.alert" |
|
staticconstexprprotected |
The documentation for this class was generated from the following files: