• 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 "js_runtime_utils.h"
21 #include "napi/native_api.h"
22 #include "wm_common.h"
23 #include "xcomponent_controller.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 using namespace Ace;
28 class PipOption : virtual public RefBase {
29 public:
30     explicit PipOption();
31     virtual ~PipOption() = default;
32     void ClearNapiRefs(napi_env env);
33     void SetContext(void* contextPtr);
34     void SetNavigationId(const std::string& navigationId);
35     void SetPipTemplate(uint32_t templateType);
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 RegisterPipContentListenerWithType(const std::string&, std::shared_ptr<NativeReference> updateNodeCallbackRef);
41     void UnRegisterPipContentListenerWithType(const std::string&);
42     void SetControlGroup(std::vector<std::uint32_t> controlGroup);
43     void* GetContext() const;
44     std::string GetNavigationId() const;
45     uint32_t GetPipTemplate();
46     std::vector<std::uint32_t> GetControlGroup();
47     std::vector<PiPControlStatusInfo> GetControlStatus();
48     std::vector<PiPControlEnableInfo> GetControlEnable();
49     void GetContentSize(uint32_t& width, uint32_t& height);
50     std::shared_ptr<XComponentController> GetXComponentController();
51     std::shared_ptr<NativeReference> GetPipContentCallbackRef(const std::string&);
52     void SetNodeControllerRef(napi_ref ref);
53     napi_ref GetNodeControllerRef() const;
54     void SetTypeNodeRef(napi_ref ref);
55     napi_ref GetTypeNodeRef() const;
56     void SetStorageRef(napi_ref ref);
57     napi_ref GetStorageRef() const;
58     void SetTypeNodeEnabled(bool enable);
59     bool IsTypeNodeEnabled() const;
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     std::vector<PiPControlStatusInfo> pipControlStatusInfoList_;
67     std::vector<PiPControlEnableInfo> pipControlEnableInfoList_;
68     std::vector<std::uint32_t> controlGroup_;
69     std::shared_ptr<XComponentController> xComponentController_ = nullptr;
70     std::map<std::string, std::shared_ptr<NativeReference>> pipContentlistenerMap_;
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