Flutter Engine
The Flutter Engine
platform_message_handler_android.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_ANDROID_PLATFORM_MESSAGE_HANDLER_ANDROID_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_MESSAGE_HANDLER_ANDROID_H_
7
8#include <jni.h>
9#include <memory>
10#include <mutex>
11#include <unordered_map>
12
13#include "flutter/lib/ui/window/platform_message.h"
14#include "flutter/shell/common/platform_message_handler.h"
15#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
16
17namespace flutter {
19 public:
21 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
22 void HandlePlatformMessage(std::unique_ptr<PlatformMessage> message) override;
24 return false;
25 }
27 int response_id,
28 std::unique_ptr<fml::Mapping> mapping) override;
29
30 void InvokePlatformMessageEmptyResponseCallback(int response_id) override;
31
32 private:
33 const std::shared_ptr<PlatformViewAndroidJNI> jni_facade_;
34 std::atomic<int> next_response_id_ = 1;
35 std::unordered_map<int, fml::RefPtr<flutter::PlatformMessageResponse>>
36 pending_responses_;
37 std::mutex pending_responses_mutex_;
38};
39} // namespace flutter
40
41#endif // FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_MESSAGE_HANDLER_ANDROID_H_
void InvokePlatformMessageEmptyResponseCallback(int response_id) override
void InvokePlatformMessageResponseCallback(int response_id, std::unique_ptr< fml::Mapping > mapping) override
PlatformMessageHandlerAndroid(const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
void HandlePlatformMessage(std::unique_ptr< PlatformMessage > message) override
Win32Message message