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/application_data.h"
17 class DictionaryValue;
21 // Utilities for manipulating the on-disk storage of applications.
23 namespace application {
27 FileDeleter(const base::FilePath& path, bool recursive);
30 void Dismiss() { path_.clear(); }
31 const base::FilePath& path() const { return path_; }
38 // Loads an application manifest from the specified directory. Returns NULL
39 // on failure, with a description of the error in |error|.
40 scoped_ptr<Manifest> LoadManifest(
41 const base::FilePath& file_path, Manifest::Type type, std::string* error);
43 base::FilePath GetManifestPath(
44 const base::FilePath& app_directory, Manifest::Type type);
46 // Loads and validates an application from the specified directory. Returns NULL
47 // on failure, with a description of the error in |error|.
48 scoped_refptr<ApplicationData> LoadApplication(
49 const base::FilePath& app_root, const std::string& app_id,
50 ApplicationData::SourceType source_type, Manifest::Type manifest_type,
53 // Get a relative file path from an app:// URL.
54 base::FilePath ApplicationURLToRelativeFilePath(const GURL& url);
56 } // namespace application
59 #endif // XWALK_APPLICATION_COMMON_APPLICATION_FILE_UTIL_H_