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_FORM_TRUST_MGR_H 17 #define OHOS_FORM_FWK_FORM_TRUST_MGR_H 18 19 #include <set> 20 #include <singleton.h> 21 #include <string> 22 23 #include "form_rdb_data_mgr.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 28 /** 29 * @class FormTrustMgr 30 * Form info storage. 31 */ 32 class FormTrustMgr final : public DelayedRefSingleton<FormTrustMgr> { 33 DECLARE_DELAYED_REF_SINGLETON(FormTrustMgr) 34 public: 35 DISALLOW_COPY_AND_MOVE(FormTrustMgr); 36 37 /** 38 * @brief Start. 39 */ 40 void Start(); 41 42 /** 43 * @brief IsTrust or not. 44 * @param bundleName Storage all form info. 45 * @return Returns result. 46 */ 47 bool IsTrust(const std::string &bundleName); 48 49 /** 50 * @brief MarkTrust. 51 * @param bundleName bundleName. 52 * @param isTrust isTrust. 53 * @return Returns result. 54 */ 55 void MarkTrustFlag(const std::string &bundleName, bool isTrust); 56 57 private: 58 std::shared_ptr<FormRdbDataMgr> rdbDataManager_; 59 std::set<std::string> unTrustList_; 60 mutable std::mutex rdbStoreMutex_; 61 }; 62 } // namespace AppExecFwk 63 } // namespace OHOS 64 #endif // OHOS_FORM_FWK_FORM_TRUST_MGR_H 65