82b997c728de89750609a063db892b4b991d3a76
[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
28  protected:
29   explicit PackageInstaller(ApplicationStorage* storage);
30   // Those to be overriden to implement platform specific logic.
31   virtual bool PlatformInstall(ApplicationData* data);
32   virtual bool PlatformUninstall(ApplicationData* data);
33   virtual bool PlatformUpdate(ApplicationData* updated_data);
34
35   ApplicationStorage* storage_;
36 };
37
38 }  // namespace application
39 }  // namespace xwalk
40
41 #endif  // XWALK_APPLICATION_COMMON_INSTALLER_PACKAGE_INSTALLER_H_