• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include "ohos_adapter_helper.h"
17 
18 #include "aafwk_app_mgr_client_adapter_impl.h"
19 #include "audio_renderer_adapter_impl.h"
20 #include "audio_system_manager_adapter_impl.h"
21 #include "battery_mgr_client_adapter_impl.h"
22 #include "datashare_adapter_impl.h"
23 #include "display_manager_adapter_impl.h"
24 #include "imf_adapter_impl.h"
25 #include "mmi_adapter_impl.h"
26 #include "net_connect_adapter_impl.h"
27 #include "ohos_init_web_adapter_impl.h"
28 #include "ohos_web_data_base_adapter_impl.h"
29 #include "ohos_web_dns_data_base_adapter_impl.h"
30 #include "ohos_web_permission_data_base_adapter_impl.h"
31 #include "pasteboard_client_adapter_impl.h"
32 #include "power_mgr_client_adapter_impl.h"
33 #include "soc_perf_client_adapter_impl.h"
34 
35 namespace OHOS::NWeb {
36 // static
GetInstance()37 OhosAdapterHelper &OhosAdapterHelper::GetInstance()
38 {
39     static OhosAdapterHelper ohosAdapter;
40     return ohosAdapter;
41 }
42 
CreateAafwkAdapter()43 std::unique_ptr<AafwkAppMgrClientAdapter> OhosAdapterHelper::CreateAafwkAdapter()
44 {
45     return std::make_unique<AafwkAppMgrClientAdapterImpl>();
46 }
47 
CreatePowerMgrClientAdapter()48 std::unique_ptr<PowerMgrClientAdapter> OhosAdapterHelper::CreatePowerMgrClientAdapter()
49 {
50     return std::make_unique<PowerMgrClientAdapterImpl>();
51 }
52 
CreateDisplayMgrAdapter()53 std::unique_ptr<DisplayManagerAdapter> OhosAdapterHelper::CreateDisplayMgrAdapter()
54 {
55     return std::make_unique<DisplayManagerAdapterImpl>();
56 }
57 
CreateBatteryClientAdapter()58 std::unique_ptr<BatteryMgrClientAdapter> OhosAdapterHelper::CreateBatteryClientAdapter()
59 {
60     return std::make_unique<BatteryMgrClientAdapterImpl>();
61 }
62 
GetOhosWebDataBaseAdapterInstance()63 OhosWebDataBaseAdapter &OhosAdapterHelper::GetOhosWebDataBaseAdapterInstance()
64 {
65     return OhosWebDataBaseAdapterImpl::GetInstance();
66 }
67 
CreateNetConnectAdapter()68 std::unique_ptr<NetConnectAdapter> OhosAdapterHelper::CreateNetConnectAdapter()
69 {
70     return std::make_unique<NetConnectAdapterImpl>();
71 }
72 
GetPasteBoard() const73 PasteBoardClientAdapter& OhosAdapterHelper::GetPasteBoard() const
74 {
75     return PasteBoardClientAdapterImpl::GetInstance();
76 }
77 
CreateAudioRendererAdapter()78 std::unique_ptr<AudioRendererAdapter> OhosAdapterHelper::CreateAudioRendererAdapter()
79 {
80     return std::make_unique<AudioRendererAdapterImpl>();
81 }
82 
GetAudioSystemManager() const83 AudioSystemManagerAdapter& OhosAdapterHelper::GetAudioSystemManager() const
84 {
85     return AudioSystemManagerAdapterImpl::GetInstance();
86 }
87 
GetWebPermissionDataBaseInstance()88 OhosWebPermissionDataBaseAdapter& OhosAdapterHelper::GetWebPermissionDataBaseInstance()
89 {
90     return OhosWebPermissionDataBaseAdapterImpl::GetInstance();
91 }
92 
CreateMMIAdapter()93 std::unique_ptr<MMIAdapter> OhosAdapterHelper::CreateMMIAdapter()
94 {
95     return std::make_unique<MMIAdapterImpl>();
96 }
97 
CreateSocPerfClientAdapter()98 std::unique_ptr<SocPerfClientAdapter> OhosAdapterHelper::CreateSocPerfClientAdapter()
99 {
100     return std::make_unique<SocPerfClientAdapterImpl>();
101 }
102 
GetWebDnsDataBaseInstance()103 OhosWebDnsDataBaseAdapter &OhosAdapterHelper::GetWebDnsDataBaseInstance()
104 {
105     return OhosWebDnsDataBaseAdapterImpl::GetInstance();
106 }
107 
GetInitWebAdapter() const108 std::unique_ptr<OhosInitWebAdapter> OhosAdapterHelper::GetInitWebAdapter() const
109 {
110     return std::make_unique<OhosInitWebAdapterImpl>();
111 }
112 
GetDatashareInstance() const113 DatashareAdapter& OhosAdapterHelper::GetDatashareInstance() const
114 {
115     return DatashareAdapterImpl::GetInstance();
116 }
117 
CreateIMFAdapter() const118 std::unique_ptr<IMFAdapter> OhosAdapterHelper::CreateIMFAdapter() const
119 {
120     return std::make_unique<IMFAdapterImpl>();
121 }
122 } // namespace OHOS::NWeb
123