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_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
6 #define CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 6 #define CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 static CONTENT_EXPORT ChildProcessSecurityPolicy* GetInstance(); | 33 static CONTENT_EXPORT ChildProcessSecurityPolicy* GetInstance(); |
34 | 34 |
35 // Web-safe schemes can be requested by any child process. Once a web-safe | 35 // Web-safe schemes can be requested by any child process. Once a web-safe |
36 // scheme has been registered, any child process can request URLs with | 36 // scheme has been registered, any child process can request URLs with |
37 // that scheme. There is no mechanism for revoking web-safe schemes. | 37 // that scheme. There is no mechanism for revoking web-safe schemes. |
38 virtual void RegisterWebSafeScheme(const std::string& scheme) = 0; | 38 virtual void RegisterWebSafeScheme(const std::string& scheme) = 0; |
39 | 39 |
40 // Returns true iff |scheme| has been registered as a web-safe scheme. | 40 // Returns true iff |scheme| has been registered as a web-safe scheme. |
41 virtual bool IsWebSafeScheme(const std::string& scheme) = 0; | 41 virtual bool IsWebSafeScheme(const std::string& scheme) = 0; |
42 | 42 |
43 // Grants certain permissions to a file. |permissions| must be a bit-set of | |
44 // base::PlatformFileFlags. | |
45 virtual void GrantPermissionsForFile(int child_id, | |
46 const base::FilePath& file, | |
47 int permissions) = 0; | |
48 | |
49 // Before servicing a child process's request to upload a file to the web, the | 43 // Before servicing a child process's request to upload a file to the web, the |
50 // browser should call this method to determine whether the process has the | 44 // browser should call this method to determine whether the process has the |
51 // capability to upload the requested file. | 45 // capability to upload the requested file. |
52 virtual bool CanReadFile(int child_id, const base::FilePath& file) = 0; | 46 virtual bool CanReadFile(int child_id, const base::FilePath& file) = 0; |
53 | 47 |
54 // Whenever the user picks a file from a <input type="file"> element, the | 48 // Whenever the user picks a file from a <input type="file"> element, the |
55 // browser should call this function to grant the child process the capability | 49 // browser should call this function to grant the child process the capability |
56 // to upload the file to the web. | 50 // to upload the file to the web. Grants FILE_PERMISSION_READ_ONLY. |
57 virtual void GrantReadFile(int child_id, const base::FilePath& file) = 0; | 51 virtual void GrantReadFile(int child_id, const base::FilePath& file) = 0; |
58 | 52 |
53 // This permission grants creation, read, and full write access to a file, | |
Tom Sepez
2013/07/09 18:52:50
nit: maybe this should be called GrantCreateReadWr
Greg Billock
2013/07/09 21:09:50
Done.
| |
54 // including attributes. | |
55 virtual void GrantReadWriteFile(int child_id, const base::FilePath& file) = 0; | |
56 | |
57 // This permission grants creation and write access to a file. | |
58 virtual void GrantCreateWriteFile(int child_id, | |
59 const base::FilePath& file) = 0; | |
60 | |
59 // Grants read access permission to the given isolated file system | 61 // Grants read access permission to the given isolated file system |
60 // identified by |filesystem_id|. An isolated file system can be | 62 // identified by |filesystem_id|. An isolated file system can be |
61 // created for a set of native files/directories (like dropped files) | 63 // created for a set of native files/directories (like dropped files) |
62 // using fileapi::IsolatedContext. A child process needs to be granted | 64 // using fileapi::IsolatedContext. A child process needs to be granted |
63 // permission to the file system to access the files in it using | 65 // permission to the file system to access the files in it using |
64 // file system URL. | 66 // file system URL. |
65 // | 67 // |
66 // Note: to grant read access to the content of files you also need | 68 // Note: to grant read access to the content of files you also need |
67 // to give permission directly to the file paths using GrantReadFile. | 69 // to give permission directly to the file paths using GrantReadFile. |
68 // TODO(kinuko): We should unify this file-level and file-system-level | 70 // TODO(kinuko): We should unify this file-level and file-system-level |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 | 109 |
108 // Returns true iff read and write access has been granted to the filesystem | 110 // Returns true iff read and write access has been granted to the filesystem |
109 // with |filesystem_id|. | 111 // with |filesystem_id|. |
110 virtual bool CanReadWriteFileSystem(int child_id, | 112 virtual bool CanReadWriteFileSystem(int child_id, |
111 const std::string& filesystem_id) = 0; | 113 const std::string& filesystem_id) = 0; |
112 }; | 114 }; |
113 | 115 |
114 }; // namespace content | 116 }; // namespace content |
115 | 117 |
116 #endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 118 #endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
OLD | NEW |