OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ |
6 #define CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ | 6 #define CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "storage/browser/fileapi/file_system_context.h" | 10 #include "storage/browser/fileapi/file_system_context.h" |
11 | 11 |
12 namespace storage { | 12 namespace storage { |
13 class FileSystemContext; | 13 class FileSystemContext; |
14 class FileSystemURL; | 14 class FileSystemURL; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class BrowserContext; | 19 class BrowserContext; |
| 20 class ChildProcessSecurityPolicyImpl; |
| 21 struct DropData; |
20 | 22 |
21 // Helper method that returns FileSystemContext constructed for | 23 // Helper method that returns FileSystemContext constructed for |
22 // the browser process. | 24 // the browser process. |
23 CONTENT_EXPORT scoped_refptr<storage::FileSystemContext> | 25 CONTENT_EXPORT scoped_refptr<storage::FileSystemContext> |
24 CreateFileSystemContext(BrowserContext* browser_context, | 26 CreateFileSystemContext(BrowserContext* browser_context, |
25 const base::FilePath& profile_path, | 27 const base::FilePath& profile_path, |
26 bool is_incognito, | 28 bool is_incognito, |
27 storage::QuotaManagerProxy* quota_manager_proxy); | 29 storage::QuotaManagerProxy* quota_manager_proxy); |
28 | 30 |
29 // Verifies that |url| is valid and has a registered backend in |context|. | 31 // Verifies that |url| is valid and has a registered backend in |context|. |
30 CONTENT_EXPORT bool FileSystemURLIsValid(storage::FileSystemContext* context, | 32 CONTENT_EXPORT bool FileSystemURLIsValid(storage::FileSystemContext* context, |
31 const storage::FileSystemURL& url); | 33 const storage::FileSystemURL& url); |
32 | 34 |
33 // Get the platform path from a file system URL. This needs to be called | 35 // Get the platform path from a file system URL. This needs to be called |
34 // on the FILE thread. | 36 // on the FILE thread. |
35 CONTENT_EXPORT void SyncGetPlatformPath(storage::FileSystemContext* context, | 37 CONTENT_EXPORT void SyncGetPlatformPath(storage::FileSystemContext* context, |
36 int process_id, | 38 int process_id, |
37 const GURL& path, | 39 const GURL& path, |
38 base::FilePath* platform_path); | 40 base::FilePath* platform_path); |
| 41 |
| 42 // Make it possible for a |drop_data|'s resources to be read by |child_id|'s |
| 43 // process -- by granting permissions, rewriting |drop_data|, or both. |
| 44 // |
| 45 // |drop_data| can include references to local files and filesystem files that |
| 46 // were accessible to the child process that is the source of the drag and drop, |
| 47 // but might not (yet) be accessible to the child process that is the target of |
| 48 // the drop. PrepareDropDataForChildProcess makes sure that |child_id| has |
| 49 // access to files referred to by |drop_data| - this method will 1) mutate |
| 50 // |drop_data| as needed (e.g. to refer to files in a new isolated filesystem, |
| 51 // rather than the original filesystem files) and 2) use |security_policy| to |
| 52 // grant |child_id| appropriate file access. |
| 53 CONTENT_EXPORT void PrepareDropDataForChildProcess( |
| 54 DropData* drop_data, |
| 55 ChildProcessSecurityPolicyImpl* security_policy, |
| 56 int child_id, |
| 57 const storage::FileSystemContext* file_system_context); |
| 58 |
39 } // namespace content | 59 } // namespace content |
40 | 60 |
41 #endif // CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ | 61 #endif // CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ |
OLD | NEW |