b32887d6f9f47d9a2a077b07241ae20ca5571893
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / installer / 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_COMMON_INSTALLER_PACKAGE_INSTALLER_H_
6 #define XWALK_APPLICATION_COMMON_INSTALLER_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 class PackageInstaller {
19  public:
20   static scoped_ptr<PackageInstaller> Create(ApplicationStorage* storage);
21
22   virtual ~PackageInstaller();
23
24   bool Install(const base::FilePath& path, std::string* id);
25   bool Uninstall(const std::string& id);
26   bool Update(const std::string& id, const base::FilePath& path);
27   void ContinueUnfinishedTasks();
28
29   virtual void SetQuiet(bool quiet);
30   virtual void SetInstallationKey(const std::string& key);
31
32  protected:
33   explicit PackageInstaller(ApplicationStorage* storage);
34
35   virtual std::string PrepareUninstallationID(const std::string& id);
36
37   // Those to be overriden to implement platform specific logic.
38   virtual bool PlatformInstall(ApplicationData* data);
39   virtual bool PlatformUninstall(ApplicationData* data);
40   virtual bool PlatformUpdate(ApplicationData* updated_data);
41
42   ApplicationStorage* storage_;
43 };
44
45 }  // namespace application
46 }  // namespace xwalk
47
48 #endif  // XWALK_APPLICATION_COMMON_INSTALLER_PACKAGE_INSTALLER_H_