Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / tools / tizen / xwalk_package_installer.h
1 // Copyright (c) 2014 Intel Corporation. All rights reserved.
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_
7 #define XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_
8
9 #include <string>
10
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace xwalk {
15 namespace application {
16
17 class ApplicationData;
18 class ApplicationStorage;
19
20 }  // namespace application
21 }  // namespace xwalk
22
23 class PlatformInstaller;
24
25 class PackageInstaller {
26  public:
27   static scoped_ptr<PackageInstaller> Create(
28       xwalk::application::ApplicationStorage* storage);
29
30   ~PackageInstaller();
31
32   bool Install(const base::FilePath& path, std::string* id);
33   bool Uninstall(const std::string& id);
34   bool Update(const std::string& id, const base::FilePath& path);
35   bool Reinstall(const std::string& pkgid);
36
37   void ContinueUnfinishedTasks();
38
39   void SetQuiet(bool quiet);
40   void SetInstallationKey(const std::string& key);
41
42  protected:
43   explicit PackageInstaller(xwalk::application::ApplicationStorage* storage);
44
45   std::string PrepareUninstallationID(const std::string& id);
46
47   bool PlatformInstall(xwalk::application::ApplicationData* data);
48   bool PlatformUninstall(const std::string& app_id);
49   bool PlatformUpdate(xwalk::application::ApplicationData* updated_data);
50   bool PlatformReinstall(const std::string& pkgid);
51
52   xwalk::application::ApplicationStorage* storage_;
53   bool quiet_;
54   std::string key_;
55
56  private:
57   void InitializePkgmgrSignal(PlatformInstaller* platform_installer,
58       const std::string& action, const std::string& action_arg);
59 };
60
61 #endif  // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_