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/tizen/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);
36 void SetLoadSet(pkg_plugin_set* set);
38 std::string type() const;
41 PkgmgrBackendPlugin();
43 void SaveInfo(scoped_refptr<xwalk::application::ApplicationData> app_data,
44 package_manager_pkg_info_t* pkg_detail_info,
45 const std::string& force_type = std::string());
47 scoped_refptr<xwalk::application::ApplicationData> app_data,
48 package_manager_pkg_detail_info_t* pkg_detail_info,
49 const std::string& force_type = std::string());
50 scoped_refptr<xwalk::application::ApplicationData> GetApplicationDataFromPkg(
51 const std::string& pkg_path, base::ScopedTempDir* dir);
53 friend struct DefaultSingletonTraits<PkgmgrBackendPlugin>;
55 scoped_ptr<xwalk::application::ApplicationStorage> storage_;
58 DISALLOW_COPY_AND_ASSIGN(PkgmgrBackendPlugin);
61 #endif // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_BACKEND_PLUGIN_H_