| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Retrieves the root path for the given |origin_url| and |type|, and | 41 // Retrieves the root path for the given |origin_url| and |type|, and |
| 42 // calls the given |callback| with the root path and name. | 42 // calls the given |callback| with the root path and name. |
| 43 // If |create| is true this also creates the directory if it doesn't exist. | 43 // If |create| is true this also creates the directory if it doesn't exist. |
| 44 void GetFileSystemRootPath(const GURL& origin_url, | 44 void GetFileSystemRootPath(const GURL& origin_url, |
| 45 fileapi::FileSystemType type, | 45 fileapi::FileSystemType type, |
| 46 bool create, | 46 bool create, |
| 47 GetRootPathCallback* callback); | 47 GetRootPathCallback* callback); |
| 48 | 48 |
| 49 // Cracks the given |path|, retrieves the information embedded in the path | 49 // Cracks the given |path|, retrieves the information embedded in the path |
| 50 // and populates |origin_url| and |type|. Also it populates |virtual_path| | 50 // and populates |origin_url| and |type|. Also it populates |root| and |
| 51 // that is a sandboxed path in the file system, i.e. the relative path to | 51 // |virtual_path|, where |virtual_path| is a sandboxed path in the file |
| 52 // the file system's root path for the given origin and type. | 52 // system, i.e. the relative path to the filesystem root for the given domain |
| 53 // It returns false if the path does not conform to the expected | 53 // and type. Concatenate |root| and |virtual_path| to get a canonical form of |
| 54 // filesystem path format. | 54 // |path|. |
| 55 // It returns false if the path does not conform to the expected filesystem |
| 56 // path format. |
| 55 bool CrackFileSystemPath(const FilePath& path, | 57 bool CrackFileSystemPath(const FilePath& path, |
| 56 GURL* origin_url, | 58 GURL* origin_url, |
| 57 FileSystemType* type, | 59 FileSystemType* type, |
| 60 FilePath* root, |
| 58 FilePath* virtual_path) const; | 61 FilePath* virtual_path) const; |
| 59 | 62 |
| 60 // Checks if a given |name| contains any restricted names/chars in it. | 63 // Checks if a given |name| contains any restricted names/chars in it. |
| 61 bool IsRestrictedFileName(const FilePath& filename) const; | 64 bool IsRestrictedFileName(const FilePath& filename) const; |
| 62 | 65 |
| 63 // Returns true if the given |url|'s scheme is allowed to access | 66 // Returns true if the given |url|'s scheme is allowed to access |
| 64 // filesystem. | 67 // filesystem. |
| 65 bool IsAllowedScheme(const GURL& url) const; | 68 bool IsAllowedScheme(const GURL& url) const; |
| 66 | 69 |
| 67 // The FileSystem directory name. | 70 // The FileSystem directory name. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 85 const FilePath base_path_; | 88 const FilePath base_path_; |
| 86 const bool is_incognito_; | 89 const bool is_incognito_; |
| 87 const bool allow_file_access_from_files_; | 90 const bool allow_file_access_from_files_; |
| 88 | 91 |
| 89 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); | 92 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); |
| 90 }; | 93 }; |
| 91 | 94 |
| 92 } // namespace fileapi | 95 } // namespace fileapi |
| 93 | 96 |
| 94 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 97 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| OLD | NEW |