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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 FileSystemPathManager::GetRootPathCallback* | 61 FileSystemPathManager::GetRootPathCallback* |
62 callback); | 62 callback); |
63 | 63 |
64 // Like GetFileSystemRootPath, but synchronous, and can be called only while | 64 // Like GetFileSystemRootPath, but synchronous, and can be called only while |
65 // running on the file thread. | 65 // running on the file thread. |
66 virtual FilePath GetFileSystemRootPathOnFileThread( | 66 virtual FilePath GetFileSystemRootPathOnFileThread( |
67 const GURL& origin_url, | 67 const GURL& origin_url, |
68 FileSystemType type, | 68 FileSystemType type, |
69 const FilePath& virtual_path, | 69 const FilePath& virtual_path, |
70 bool create); | 70 bool create); |
71 // Cracks the given |path|, retrieves the information embedded in the path | |
72 // and populates |origin_url|, |type| and |virtual_path|. The |virtual_path| | |
73 // is a sandboxed path in the file system, i.e. the relative path to the | |
74 // filesystem root for the given domain and type. | |
75 bool CrackFileSystemPath(const FilePath& path, | |
76 GURL* origin_url, | |
77 FileSystemType* type, | |
78 FilePath* virtual_path) const; | |
79 | 71 |
80 // Returns true if the given |url|'s scheme is allowed to access | 72 // Returns true if the given |url|'s scheme is allowed to access |
81 // filesystem. | 73 // filesystem. |
82 bool IsAllowedScheme(const GURL& url) const; | 74 bool IsAllowedScheme(const GURL& url) const; |
83 | 75 |
84 // Returns the string for the given |type|. | 76 // Returns the string for the given |type|. |
85 // Returns an empty string if the |type| is invalid. | 77 // Returns an empty string if the |type| is invalid. |
86 static std::string GetFileSystemTypeString(fileapi::FileSystemType type); | 78 static std::string GetFileSystemTypeString(fileapi::FileSystemType type); |
87 | 79 |
88 // Checks if a given |name| contains any restricted names/chars in it. | 80 // Checks if a given |name| contains any restricted names/chars in it. |
89 bool IsRestrictedFileName(FileSystemType type, | 81 bool IsRestrictedFileName(FileSystemType type, |
90 const FilePath& filename); | 82 const FilePath& filename); |
91 | 83 |
| 84 // Checks if an origin has access to a particular filesystem type. |
| 85 bool IsAllowedFileSystemType(GURL origin, FileSystemType type); |
| 86 |
92 SandboxMountPointProvider* sandbox_provider() const { | 87 SandboxMountPointProvider* sandbox_provider() const { |
93 return sandbox_provider_.get(); | 88 return sandbox_provider_.get(); |
94 } | 89 } |
95 | 90 |
96 bool is_incognito() const { | 91 bool is_incognito() const { |
97 return is_incognito_; | 92 return is_incognito_; |
98 } | 93 } |
99 | 94 |
100 private: | 95 private: |
101 const bool is_incognito_; | 96 const bool is_incognito_; |
102 const bool allow_file_access_from_files_; | 97 const bool allow_file_access_from_files_; |
103 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 98 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
104 scoped_ptr<FileSystemMountPointProvider> local_provider_; | 99 scoped_ptr<FileSystemMountPointProvider> local_provider_; |
105 | 100 |
106 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); | 101 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); |
107 }; | 102 }; |
108 | 103 |
109 } // namespace fileapi | 104 } // namespace fileapi |
110 | 105 |
111 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 106 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
OLD | NEW |