1 /* 2 * Copyright (c) 2024 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 FOUNDATION_ACE_FRAMEWORKS_COMPATIBLE_COMPONENTS_COMPONENT_LOADER 17 #define FOUNDATION_ACE_FRAMEWORKS_COMPATIBLE_COMPONENTS_COMPONENT_LOADER 18 19 #include <cstdint> 20 #include "base/memory/referenced.h" 21 22 namespace OHOS::Ace { 23 24 class Declaration; 25 class PipelineBase; 26 27 namespace Framework { 28 class DOMNode; 29 class JsCommand; 30 } 31 32 namespace V2 { 33 class InspectorComposedElement; 34 } 35 36 struct CanvasBridgeParams { 37 RefPtr<PipelineBase> pipeline; 38 int32_t width; 39 int32_t height; 40 bool isOffscreen; 41 }; 42 43 class ComponentLoader { 44 public: 45 ComponentLoader() = default; 46 virtual ~ComponentLoader() = default; 47 48 virtual RefPtr<Framework::DOMNode> CreateDomNode(int32_t nodeId, const std::string& nodeName) = 0; 49 virtual void* CreateModel() = 0; 50 virtual RefPtr<V2::InspectorComposedElement> CreateInspectorElement(const std::string& id) = 0; CreateDeclaration()51 virtual RefPtr<Declaration> CreateDeclaration() 52 { 53 return nullptr; 54 } UpdateDomConfig(const RefPtr<Framework::DOMNode> & node,void * config)55 virtual void UpdateDomConfig(const RefPtr<Framework::DOMNode>& node, void* config) {} 56 57 static ComponentLoader* GetLoaderByName(const char* name); 58 }; 59 60 } // namespace OHOS::Ace 61 62 #endif // FOUNDATION_ACE_FRAMEWORKS_COMPATIBLE_COMPONENTS_COMPONENT_LOADER 63