Upstream version 7.35.141.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/browser/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     Package::Type package_type,
42     std::string* error);
43
44 // Loads an application manifest from the specified directory. Returns NULL
45 // on failure, with a description of the error in |error|.
46 base::DictionaryValue* LoadManifest(const base::FilePath& application_root,
47                                     Package::Type package_type,
48                                     std::string* error);
49
50 // Get a relative file path from an app:// URL.
51 base::FilePath ApplicationURLToRelativeFilePath(const GURL& url);
52
53 }  // namespace application
54 }  // namespace xwalk
55
56 #endif  // XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_