Upstream version 8.37.183.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / application_file_util.h
1 // Copyright (c) 2012 The Chromium Authors. 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_APPLICATION_FILE_UTIL_H_
6 #define XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_
7
8 #include <string>
9 #include <map>
10
11 #include "base/memory/ref_counted.h"
12 #include "xwalk/application/common/installer/package.h"
13 #include "xwalk/application/common/manifest.h"
14
15
16 class GURL;
17
18 namespace base {
19 class DictionaryValue;
20 class FilePath;
21 }
22
23 // Utilities for manipulating the on-disk storage of applications.
24 namespace xwalk {
25 namespace application {
26
27 class ApplicationData;
28
29 // Loads and validates an application from the specified directory. Returns NULL
30 // on failure, with a description of the error in |error|.
31 scoped_refptr<ApplicationData> LoadApplication(
32     const base::FilePath& application_root,
33     Manifest::SourceType source_type,
34     std::string* error);
35
36 // The same as LoadApplication except use the provided |application_id|.
37 scoped_refptr<ApplicationData> LoadApplication(
38     const base::FilePath& application_root,
39     const std::string& application_id,
40     Manifest::SourceType source_type,
41     std::string* error);
42
43 scoped_refptr<ApplicationData> LoadApplication(
44     const base::FilePath& application_root,
45     const std::string& application_id,
46     Manifest::SourceType source_type,
47     Package::Type package_type,
48     std::string* error);
49
50 // Loads an application manifest from the specified directory. Returns NULL
51 // on failure, with a description of the error in |error|.
52 base::DictionaryValue* LoadManifest(const base::FilePath& application_root,
53                                     Package::Type package_type,
54                                     std::string* error);
55
56 // Get a relative file path from an app:// URL.
57 base::FilePath ApplicationURLToRelativeFilePath(const GURL& url);
58
59 }  // namespace application
60 }  // namespace xwalk
61
62 #endif  // XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_