• 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 // 2021.4.30 platform view adapt ohos.
5 //           Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
6 
7 #ifndef FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SHELL_HOLDER_H_
8 #define FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SHELL_HOLDER_H_
9 
10 #include <memory>
11 
12 #include "flutter/fml/macros.h"
13 #include "flutter/fml/unique_fd.h"
14 #include "flutter/lib/ui/window/viewport_metrics.h"
15 #include "flutter/shell/common/run_configuration.h"
16 #include "flutter/shell/common/shell.h"
17 #include "flutter/shell/common/thread_host.h"
18 #include "flutter/shell/platform/ohos/platform_view_ohos.h"
19 
20 namespace flutter {
21 
22 class OhosShellHolder {
23  public:
24   OhosShellHolder(flutter::Settings settings,
25                      bool is_background_view);
26 
27   ~OhosShellHolder();
28 
29   bool IsValid() const;
30 
31   void Launch(RunConfiguration configuration);
32 
33   const flutter::Settings& GetSettings() const;
34 
35   fml::WeakPtr<PlatformViewOhos> GetPlatformView();
36 
37   Rasterizer::Screenshot Screenshot(Rasterizer::ScreenshotType type,
38                                     bool base64_encode);
39 
40   void UpdateAssetManager(fml::RefPtr<flutter::AssetManager> asset_manager);
41 
42  private:
43   const flutter::Settings settings_;
44   fml::WeakPtr<PlatformViewOhos> platform_view_;
45   ThreadHost thread_host_;
46   std::unique_ptr<Shell> shell_;
47   bool is_valid_ = false;
48 
49   FML_DISALLOW_COPY_AND_ASSIGN(OhosShellHolder);
50 };
51 
52 }  // namespace flutter
53 
54 #endif  // FLUTTER_SHELL_PLATFORM_OHOS_OHOS_SHELL_HOLDER_H_
55