| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Retrieves the root path for the given |origin_url| and |type|, and | 45 // Retrieves the root path for the given |origin_url| and |type|, and |
| 46 // calls the given |callback| with the root path and name. | 46 // calls the given |callback| with the root path and name. |
| 47 // If |create| is true this also creates the directory if it doesn't exist. | 47 // If |create| is true this also creates the directory if it doesn't exist. |
| 48 void GetFileSystemRootPath(const GURL& origin_url, | 48 void GetFileSystemRootPath(const GURL& origin_url, |
| 49 fileapi::FileSystemType type, | 49 fileapi::FileSystemType type, |
| 50 bool create, | 50 bool create, |
| 51 GetRootPathCallback* callback); | 51 GetRootPathCallback* callback); |
| 52 | 52 |
| 53 // Cracks the given |path|, retrieves the information embedded in the path | 53 // Cracks the given |path|, retrieves the information embedded in the path |
| 54 // and populates |origin_url| and |type|. Also it populates |virtual_path| | 54 // and populates |origin_url| and |type|. Also it populates |root| and |
| 55 // that is a sandboxed path in the file system, i.e. the relative path to | 55 // |virtual_path|, where |virtual_path| is a sandboxed path in the file |
| 56 // the file system's root path for the given origin and type. | 56 // system, i.e. the relative path to the filesystem root for the given domain |
| 57 // It returns false if the path does not conform to the expected | 57 // and type. Concatenate |root| and |virtual_path| to get a canonical form of |
| 58 // filesystem path format. | 58 // |path|. |
| 59 // It returns false if the path does not conform to the expected filesystem |
| 60 // path format. |
| 59 bool CrackFileSystemPath(const FilePath& path, | 61 bool CrackFileSystemPath(const FilePath& path, |
| 60 GURL* origin_url, | 62 GURL* origin_url, |
| 61 FileSystemType* type, | 63 FileSystemType* type, |
| 64 FilePath* root, |
| 62 FilePath* virtual_path) const; | 65 FilePath* virtual_path) const; |
| 63 | 66 |
| 64 // Checks if a given |name| contains any restricted names/chars in it. | 67 // Checks if a given |name| contains any restricted names/chars in it. |
| 65 bool IsRestrictedFileName(const FilePath& filename) const; | 68 bool IsRestrictedFileName(const FilePath& filename) const; |
| 66 | 69 |
| 67 // Returns true if the given |url|'s scheme is allowed to access | 70 // Returns true if the given |url|'s scheme is allowed to access |
| 68 // filesystem. | 71 // filesystem. |
| 69 bool IsAllowedScheme(const GURL& url) const; | 72 bool IsAllowedScheme(const GURL& url) const; |
| 70 | 73 |
| 71 // The FileSystem directory name. | 74 // The FileSystem directory name. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const FilePath base_path_; | 108 const FilePath base_path_; |
| 106 const bool is_incognito_; | 109 const bool is_incognito_; |
| 107 const bool allow_file_access_from_files_; | 110 const bool allow_file_access_from_files_; |
| 108 | 111 |
| 109 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); | 112 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 } // namespace fileapi | 115 } // namespace fileapi |
| 113 | 116 |
| 114 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 117 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| OLD | NEW |