• 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 FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_STATE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_STATE_H_
7 
8 #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h"
9 #include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h"
10 #include "flutter/shell/platform/embedder/embedder.h"
11 #include "flutter/shell/platform/windows/key_event_handler.h"
12 #include "flutter/shell/platform/windows/keyboard_hook_handler.h"
13 #include "flutter/shell/platform/windows/platform_handler.h"
14 #include "flutter/shell/platform/windows/text_input_plugin.h"
15 
16 struct flutter::Win32FlutterWindow;
17 
18 // Struct for storing state within an instance of the windows native (HWND or
19 // CoreWindow) Window.
20 struct FlutterDesktopWindowControllerState {
21   //// The win32 window that owns this state object.
22   std::unique_ptr<flutter::Win32FlutterWindow> window;
23 
24   // The handle to the Flutter engine instance.
25   FLUTTER_API_SYMBOL(FlutterEngine) engine;
26 
27   // The window handle given to API clients.
28   std::unique_ptr<FlutterDesktopWindow> window_wrapper;
29 };
30 
31 // Opaque reference for the native windows itself. This is separate from the
32 // controller so that it can be provided to plugins without giving them access
33 // to all of the controller-based functionality.
34 struct FlutterDesktopWindow {
35   // The window that (indirectly) owns this state object.
36   flutter::Win32FlutterWindow* window;
37 };
38 
39 // Struct for storing state of a Flutter engine instance.
40 struct FlutterDesktopEngineState {
41   // The handle to the Flutter engine instance.
42   FLUTTER_API_SYMBOL(FlutterEngine) engine;
43 };
44 
45 // State associated with the plugin registrar.
46 struct FlutterDesktopPluginRegistrar {
47   // The plugin messenger handle given to API clients.
48   std::unique_ptr<FlutterDesktopMessenger> messenger;
49 
50   // The handle for the window associated with this registrar.
51   FlutterDesktopWindow* window;
52 };
53 
54 // State associated with the messenger used to communicate with the engine.
55 struct FlutterDesktopMessenger {
56   // The Flutter engine this messenger sends outgoing messages to.
57   FLUTTER_API_SYMBOL(FlutterEngine) engine;
58 
59   // The message dispatcher for handling incoming messages.
60   flutter::IncomingMessageDispatcher* dispatcher;
61 };
62 
63 #endif  // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_STATE_H_
64