Add WgtInstallerFactory and HybridInstallerFactory
[platform/core/appfw/wgt-backend.git] / src / hybrid / hybrid_installer_factory.cc
1 // Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #include "hybrid/hybrid_installer_factory.h"
6
7 #include <unzip.h>
8
9 #include <manifest_parser/utils/logging.h>
10 #include <hybrid/hybrid_installer.h>
11 #include <wgt/utils/wgt_app_query_interface.h>
12 #include <wgt/wgt_installer.h>
13
14 #include <map>
15 #include <memory>
16 #include <string>
17
18 #include "common/pkgmgr_interface.h"
19 #include "common/pkgmgr_query.h"
20
21 namespace ci = common_installer;
22
23 namespace hybrid {
24
25 std::unique_ptr<ci::AppInstaller> HybridInstallerFactory::CreateInstaller(
26     ci::PkgMgrPtr pkgmgr, int idx) {
27   std::unique_ptr<ci::AppInstaller> installer;
28   wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
29
30   pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
31   installer.reset(new hybrid::HybridInstaller(pkgmgr));
32   installer->SetIndex(idx);
33
34   return installer;
35 }
36
37 }  // namespace hybrid