Upstream version 10.38.222.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 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_
6 #define XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_
7
8 #include <string>
9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h"
11
12 namespace xwalk {
13 namespace application {
14
15 class ApplicationData;
16 class ApplicationStorage;
17
18 }  // namespace application
19 }  // namespace xwalk
20
21 class PackageInstaller {
22  public:
23   static scoped_ptr<PackageInstaller> Create(
24     xwalk::application::ApplicationStorage* storage);
25
26   ~PackageInstaller();
27
28   bool Install(const base::FilePath& path, std::string* id);
29   bool Uninstall(const std::string& id);
30   bool Update(const std::string& id, const base::FilePath& path);
31   bool Reinstall(const base::FilePath& path);
32
33   void ContinueUnfinishedTasks();
34
35   void SetQuiet(bool quiet);
36   void SetInstallationKey(const std::string& key);
37
38  protected:
39   explicit PackageInstaller(xwalk::application::ApplicationStorage* storage);
40
41   std::string PrepareUninstallationID(const std::string& id);
42
43   bool PlatformInstall(xwalk::application::ApplicationData* data);
44   bool PlatformUninstall(const std::string& app_id);
45   bool PlatformUpdate(xwalk::application::ApplicationData* updated_data);
46   bool PlatformReinstall(const base::FilePath& path);
47
48   xwalk::application::ApplicationStorage* storage_;
49   bool quiet_;
50   std::string key_;
51 };
52
53
54
55 #endif  // XWALK_APPLICATION_TOOLS_TIZEN_XWALK_PACKAGE_INSTALLER_H_