• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_PLATFORM_MESSAGE_ROUTER_H_
6 #define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_PLATFORM_MESSAGE_ROUTER_H_
7 
8 #include <unordered_map>
9 
10 #include "flutter/fml/memory/weak_ptr.h"
11 #include "flutter/fml/platform/darwin/scoped_block.h"
12 #include "flutter/lib/ui/window/platform_message.h"
13 #include "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h"
14 
15 namespace flutter {
16 
17 class PlatformMessageRouter {
18  public:
19   PlatformMessageRouter();
20   ~PlatformMessageRouter();
21 
22   void HandlePlatformMessage(
23       fml::RefPtr<flutter::PlatformMessage> message) const;
24 
25   void SetMessageHandler(const std::string& channel,
26                          FlutterBinaryMessageHandler handler);
27 
28  private:
29   std::unordered_map<std::string, fml::ScopedBlock<FlutterBinaryMessageHandler>>
30       message_handlers_;
31 
32   FML_DISALLOW_COPY_AND_ASSIGN(PlatformMessageRouter);
33 };
34 
35 }  // namespace flutter
36 
37 #endif  // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
38