| Flutter Windows Embedder |

flutter_windows_view_controller.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_WINDOWS_FLUTTER_WINDOWS_VIEW_CONTROLLER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_VIEW_CONTROLLER_H_
7
8 #include <memory>
9
10 #include "flutter/fml/macros.h"
11 #include "flutter/shell/platform/windows/flutter_windows_engine.h"
12 #include "flutter/shell/platform/windows/flutter_windows_view.h"
13
14 namespace flutter {
15
16 /// Controls a view that displays Flutter content.
17 class FlutterWindowsViewController {
18 public:
19 FlutterWindowsViewController(std::unique_ptr<FlutterWindowsEngine> engine,
20 std::unique_ptr<FlutterWindowsView> view)
21 : engine_(std::move(engine)), view_(std::move(view)) {}
22
23 ~FlutterWindowsViewController();
24
25 // Destroy this view controller and its view.
26 //
27 // If this view controller owns the engine, the engine is also destroyed.
28 void Destroy();
29
30 FlutterWindowsEngine* engine() { return view_->GetEngine(); }
31 FlutterWindowsView* view() { return view_.get(); }
32
33 private:
34 // The engine owned by this view controller, if any.
35 //
36 // This is used only if the view controller was created
37 // using |FlutterDesktopViewControllerCreate| as that takes
38 // ownership of the engine. Destroying this view controller
39 // also destroys the engine.
40 //
41 // View controllers created using |FlutterDesktopEngineCreateViewController|
42 // do not take ownership of the engine and this will be null. Destroying
43 // this view controller does not destroy the engine.
44 std::unique_ptr<FlutterWindowsEngine> engine_;
45
46 std::unique_ptr<FlutterWindowsView> view_;
47
48 FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsViewController);
49 };
50
51 } // namespace flutter
52
53 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_VIEW_CONTROLLER_H_
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:92
flutter::FlutterWindowsViewController
Controls a view that displays Flutter content.
Definition: flutter_windows_view_controller.h:17
flutter::FlutterWindowsViewController::Destroy
void Destroy()
Definition: flutter_windows_view_controller.cc:13
flutter::FlutterWindowsViewController::view
FlutterWindowsView * view()
Definition: flutter_windows_view_controller.h:31
flutter::FlutterWindowsViewController::~FlutterWindowsViewController
~FlutterWindowsViewController()
Definition: flutter_windows_view_controller.cc:9
flutter::FlutterWindowsViewController::FlutterWindowsViewController
FlutterWindowsViewController(std::unique_ptr< FlutterWindowsEngine > engine, std::unique_ptr< FlutterWindowsView > view)
Definition: flutter_windows_view_controller.h:19
flutter::FlutterWindowsViewController::engine
FlutterWindowsEngine * engine()
Definition: flutter_windows_view_controller.h:30
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:34
flutter_windows_engine.h
flutter_windows_view.h
flutter
Definition: accessibility_bridge_windows.cc:11