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 #ifndef NDEF_HAR_DISPATCH_H
16 #define NDEF_HAR_DISPATCH_H
17 
18 #include <shared_mutex>
19 #include <string>
20 #include "app_data_parser.h"
21 #include "if_system_ability_manager.h"
22 #include "taginfo.h"
23 
24 namespace OHOS {
25 namespace NFC {
26 namespace TAG {
27 class NdefHarDispatch {
28 public:
29     NdefHarDispatch();
~NdefHarDispatch()30     ~NdefHarDispatch() {}
31     static NdefHarDispatch& GetInstance();
32     bool DispatchBundleAbility(
33         const std::string &harPackage, std::shared_ptr<KITS::TagInfo> tagInfo, const std::string &mimeType,
34         const std::string &uri);
35     bool DispatchUriToBundleAbility(const std::string &uri);
36     bool DispatchMimeType(const std::string &type, std::shared_ptr<KITS::TagInfo> tagInfo);
37     bool DispatchWebLink(const std::string &webAddress, const std::string &browserBundleName);
38     void OnBrowserOpenLink();
39 
40 private:
41     static sptr<AppExecFwk::IBundleMgr> GetBundleMgrProxy();
42     std::shared_mutex mutex_ {};
43 };
44 } // namespace TAG
45 } // namespace NFC
46 } // namespace OHOS
47 #endif // NDEF_HAR_DISPATCH_H