1 /* 2 * Copyright (c) 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_FORM_FWK_APP_MODULE_CHECKER_H 17 #define OHOS_FORM_FWK_APP_MODULE_CHECKER_H 18 19 #include <set> 20 #include <unordered_map> 21 #include <unordered_set> 22 23 #include "module_checker_delegate.h" 24 25 namespace { 26 constexpr int32_t EXTENSION_TYPE_UNKNOWN = 255; 27 } 28 29 /** 30 * @brief Form module load checker. check whether module can be loaded in form 31 * 32 */ 33 class AppModuleChecker : public ModuleCheckerDelegate { 34 public: 35 AppModuleChecker(int32_t extensionType, 36 const std::unordered_map<int32_t, std::unordered_set<std::string>>& extensionBlocklist); 37 ~AppModuleChecker() override = default; 38 39 bool CheckModuleLoadable(const char* moduleName, 40 std::unique_ptr<ApiAllowListChecker>& apiAllowListChecker, bool isAppModule) override; 41 bool DiskCheckOnly() override; 42 protected: 43 std::set<std::string> blockList_; 44 }; 45 46 #endif /* OHOS_FORM_FWK_APP_MODULE_CHECKER_H */