1 /** 2 * Copyright (c) 2025 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 #ifndef PLUGINS_ETS_RUNTIME_NAMESPACE_MANAGER_H 16 #define PLUGINS_ETS_RUNTIME_NAMESPACE_MANAGER_H 17 18 #include <map> 19 #include <string> 20 #include <libpandabase/macros.h> 21 #include <functional> 22 using CreateNamespaceCallback = std::function<bool(const std::string &bundleModuleName, std::string &namespaceName)>; 23 using ExtensionApiCheckCallback = std::function<bool(const std::string &className, const std::string &fileName)>; 24 25 // key is abcPath, value is namespaceName 26 using AppBundleModuleNamePathMap = std::map<std::string, std::string>; 27 namespace ark::ets { 28 class PANDA_PUBLIC_API EtsNamespaceManager { 29 public: 30 static void SetAppLibPaths(const AppBundleModuleNamePathMap &appModuleNames, CreateNamespaceCallback &cb); 31 static void SetExtensionApiCheckCallback(const ExtensionApiCheckCallback &cb); 32 ~EtsNamespaceManager() = default; 33 34 NO_COPY_SEMANTIC(EtsNamespaceManager); 35 NO_MOVE_SEMANTIC(EtsNamespaceManager); 36 37 private: 38 EtsNamespaceManager() = default; 39 }; 40 } // namespace ark::ets 41 #endif // !PLUGINS_ETS_RUNTIME_NAMESPACE_MANAGER_H