1 // Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef XWALK_APPLICATION_TOOLS_TIZEN_XWALK_BACKEND_PLUGIN_H_
6 #define XWALK_APPLICATION_TOOLS_TIZEN_XWALK_BACKEND_PLUGIN_H_
8 #include <package-manager.h>
9 #include <package-manager-types.h>
10 #include <package-manager-plugin.h>
14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/singleton.h"
18 #include "xwalk/application/common/application_storage.h"
20 template <typename Type>
21 struct PkgmgrBackendPluginTraits : DefaultSingletonTraits<Type> {
22 static const bool kRegisterAtExit = false;
25 class PkgmgrBackendPlugin {
27 static PkgmgrBackendPlugin* GetInstance();
29 int DetailedInfo(const std::string& pkgid,
30 package_manager_pkg_detail_info_t* pkg_detail_info);
31 int DetailedInfoPkg(const std::string& pkg_path,
32 package_manager_pkg_detail_info_t* pkg_detail_info);
33 int IsAppInstalled(const std::string& pkgid);
34 int AppsList(package_manager_pkg_info_t** list, int* count);
37 PkgmgrBackendPlugin();
39 void SaveInfo(xwalk::application::ApplicationData* app_data,
40 package_manager_pkg_info_t* pkg_detail_info);
41 void SaveDetailInfo(xwalk::application::ApplicationData* app_data,
42 package_manager_pkg_detail_info_t* pkg_detail_info);
43 scoped_refptr<xwalk::application::ApplicationData> GetApplicationDataFromPkg(
44 const std::string& pkg_path);
46 friend struct DefaultSingletonTraits<PkgmgrBackendPlugin>;
48 scoped_ptr<xwalk::application::ApplicationStorage> storage_;
50 DISALLOW_COPY_AND_ASSIGN(PkgmgrBackendPlugin);
53 #endif // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_BACKEND_PLUGIN_H_