Flutter Engine
The Flutter Engine
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
14namespace flutter {
15
16/// Controls a view that displays Flutter content.
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
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_
Controls a view that displays Flutter content.
FlutterWindowsViewController(std::unique_ptr< FlutterWindowsEngine > engine, std::unique_ptr< FlutterWindowsView > view)
Definition: ref_ptr.h:256