Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
platform_message_handler.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_COMMON_PLATFORM_MESSAGE_HANDLER_H_
6#define FLUTTER_SHELL_COMMON_PLATFORM_MESSAGE_HANDLER_H_
7
8#include <memory>
9
10#include "flutter/fml/mapping.h"
11
12namespace flutter {
13
14class PlatformMessage;
15
16/// An interface over the ability to handle PlatformMessages that are being sent
17/// from Flutter to the host platform.
19 public:
20 virtual ~PlatformMessageHandler() = default;
21
22 /// Ultimately sends the PlatformMessage to the host platform.
23 /// This method is invoked on the ui thread.
25 std::unique_ptr<PlatformMessage> message) = 0;
26
27 /// Returns true if the platform message will ALWAYS be dispatched to the
28 /// platform thread.
29 ///
30 /// Platforms that support Background Platform Channels will return
31 /// false.
33
34 /// Performs the return procedure for an associated call to
35 /// HandlePlatformMessage.
36 /// This method should be thread-safe and able to be invoked on any thread.
38 int response_id,
39 std::unique_ptr<fml::Mapping> mapping) = 0;
40
41 /// Performs the return procedure for an associated call to
42 /// HandlePlatformMessage where there is no return value.
43 /// This method should be thread-safe and able to be invoked on any thread.
44 virtual void InvokePlatformMessageEmptyResponseCallback(int response_id) = 0;
45};
46} // namespace flutter
47
48#endif // FLUTTER_SHELL_COMMON_PLATFORM_MESSAGE_HANDLER_H_
virtual void HandlePlatformMessage(std::unique_ptr< PlatformMessage > message)=0
virtual void InvokePlatformMessageEmptyResponseCallback(int response_id)=0
virtual bool DoesHandlePlatformMessageOnPlatformThread() const =0
virtual void InvokePlatformMessageResponseCallback(int response_id, std::unique_ptr< fml::Mapping > mapping)=0
virtual ~PlatformMessageHandler()=default
Win32Message message