• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_PIP_OPTION_H
17 #define OHOS_PIP_OPTION_H
18 #include <refbase.h>
19 #include <string>
20 #include "napi/native_api.h"
21 #include "wm_common.h"
22 #include "xcomponent_controller.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 using namespace Ace;
27 class PipOption : virtual public RefBase {
28 public:
29     explicit PipOption();
30     virtual ~PipOption() = default;
31     void ClearNapiRefs(napi_env env);
32     void SetContext(void* contextPtr);
33     void SetNavigationId(const std::string& navigationId);
34     void SetPipTemplate(uint32_t templateType);
35     void SetDefaultWindowSizeType(uint32_t defaultWindowSizeType);
36     void SetContentSize(uint32_t width, uint32_t height);
37     void SetPiPControlStatus(PiPControlType controlType, PiPControlStatus status);
38     void SetPiPControlEnabled(PiPControlType controlType, PiPControlStatus enabled);
39     void SetXComponentController(std::shared_ptr<XComponentController> xComponentController);
40     void SetControlGroup(std::vector<std::uint32_t> controlGroup);
41     void* GetContext() const;
42     std::string GetNavigationId() const;
43     uint32_t GetPipTemplate();
44     uint32_t GetDefaultWindowSizeType() const;
45     std::vector<std::uint32_t> GetControlGroup();
46     std::vector<PiPControlStatusInfo> GetControlStatus();
47     std::vector<PiPControlEnableInfo> GetControlEnable();
48     void GetContentSize(uint32_t& width, uint32_t& height);
49     std::shared_ptr<XComponentController> GetXComponentController();
50     void SetNodeControllerRef(napi_ref ref);
51     napi_ref GetNodeControllerRef() const;
52     void SetTypeNodeRef(napi_ref ref);
53     napi_ref GetTypeNodeRef() const;
54     void SetStorageRef(napi_ref ref);
55     napi_ref GetStorageRef() const;
56     void SetTypeNodeEnabled(bool enable);
57     bool IsTypeNodeEnabled() const;
58     uint32_t GetPipPriority(uint32_t pipTemplateType) const;
59     void GetPiPTemplateInfo(PiPTemplateInfo& pipTemplateInfo);
60 private:
61     void* contextPtr_ = nullptr;
62     uint32_t templateType_  = 0;
63     std::string navigationId_ = "";
64     uint32_t contentWidth_ = 0;
65     uint32_t contentHeight_ = 0;
66     uint32_t defaultWindowSizeType_ = 0;
67     std::vector<PiPControlStatusInfo> pipControlStatusInfoList_;
68     std::vector<PiPControlEnableInfo> pipControlEnableInfoList_;
69     std::vector<std::uint32_t> controlGroup_;
70     std::shared_ptr<XComponentController> xComponentController_ = nullptr;
71     napi_ref customNodeController_ = nullptr;
72     napi_ref typeNode_ = nullptr;
73     bool useTypeNode_ = false;
74     napi_ref storage_ = nullptr;
75 };
76 }
77 }
78 #endif //OHOS_PIP_OPTION_H
79