flutter_window.h 933 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef FLUTTER_WINDOW_H_
  2. #define FLUTTER_WINDOW_H_
  3. #include <flutter/dart_project.h>
  4. #include <flutter/flutter_view_controller.h>
  5. #include "run_loop.h"
  6. #include "win32_window.h"
  7. #include <memory>
  8. // A window that does nothing but host a Flutter view.
  9. class FlutterWindow : public Win32Window {
  10. public:
  11. // Creates a new FlutterWindow driven by the |run_loop|, hosting a
  12. // Flutter view running |project|.
  13. explicit FlutterWindow(RunLoop* run_loop,
  14. const flutter::DartProject& project);
  15. virtual ~FlutterWindow();
  16. protected:
  17. // Win32Window:
  18. void OnCreate() override;
  19. void OnDestroy() override;
  20. private:
  21. // The run loop driving events for this window.
  22. RunLoop* run_loop_;
  23. // The project to run.
  24. flutter::DartProject project_;
  25. // The Flutter instance hosted by this window.
  26. std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
  27. };
  28. #endif // FLUTTER_WINDOW_H_