Upstream version 10.39.233.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 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12
13 namespace xwalk {
14 namespace application {
15
16 class ApplicationData;
17 class ApplicationStorage;
18
19 }  // namespace application
20 }  // namespace xwalk
21
22 class PlatformInstaller;
23
24 class PackageInstaller {
25  public:
26   static scoped_ptr<PackageInstaller> Create(
27     xwalk::application::ApplicationStorage* storage);
28
29   ~PackageInstaller();
30
31   bool Install(const base::FilePath& path, std::string* id);
32   bool Uninstall(const std::string& id);
33   bool Update(const std::string& id, const base::FilePath& path);
34   bool Reinstall(const base::FilePath& path);
35
36   void ContinueUnfinishedTasks();
37
38   void SetQuiet(bool quiet);
39   void SetInstallationKey(const std::string& key);
40
41  protected:
42   explicit PackageInstaller(xwalk::application::ApplicationStorage* storage);
43
44   std::string PrepareUninstallationID(const std::string& id);
45
46   bool PlatformInstall(xwalk::application::ApplicationData* data);
47   bool PlatformUninstall(const std::string& app_id);
48   bool PlatformUpdate(xwalk::application::ApplicationData* updated_data);
49   bool PlatformReinstall(const base::FilePath& path);
50
51   xwalk::application::ApplicationStorage* storage_;
52   bool quiet_;
53   std::string key_;
54
55  private:
56   void InitializePkgmgrSignal(PlatformInstaller* platform_installer,
57       const std::string& action, const std::string& action_arg);
58 };
59
60 #endif  // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_