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.
5 #ifndef XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_
6 #define XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_
11 #include "base/memory/ref_counted.h"
12 #include "xwalk/application/common/installer/package.h"
13 #include "xwalk/application/common/manifest.h"
19 class DictionaryValue;
23 // Utilities for manipulating the on-disk storage of applications.
25 namespace application {
27 class ApplicationData;
31 FileDeleter(const base::FilePath& path, bool recursive);
34 void Dismiss() { path_.clear(); }
35 const base::FilePath& path() const { return path_; }
42 // Loads and validates an application from the specified directory. Returns NULL
43 // on failure, with a description of the error in |error|.
44 scoped_refptr<ApplicationData> LoadApplication(
45 const base::FilePath& application_root,
46 Manifest::SourceType source_type,
49 // The same as LoadApplication except use the provided |application_id|.
50 scoped_refptr<ApplicationData> LoadApplication(
51 const base::FilePath& application_root,
52 const std::string& application_id,
53 Manifest::SourceType source_type,
56 scoped_refptr<ApplicationData> LoadApplication(
57 const base::FilePath& application_root,
58 const std::string& application_id,
59 Manifest::SourceType source_type,
60 Package::Type package_type,
63 // Loads an application manifest from the specified directory. Returns NULL
64 // on failure, with a description of the error in |error|.
65 base::DictionaryValue* LoadManifest(const base::FilePath& application_root,
66 Package::Type package_type,
69 // Get a relative file path from an app:// URL.
70 base::FilePath ApplicationURLToRelativeFilePath(const GURL& url);
72 } // namespace application
75 #endif // XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_