Chromium Code Reviews| 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_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 6 #define CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // --enable-strict-site-isolation or --site-per-process flags are used. | 171 // --enable-strict-site-isolation or --site-per-process flags are used. |
| 172 bool CanSendCookiesForOrigin(int child_id, const GURL& gurl); | 172 bool CanSendCookiesForOrigin(int child_id, const GURL& gurl); |
| 173 | 173 |
| 174 // Sets the process as only permitted to use and see the cookies for the | 174 // Sets the process as only permitted to use and see the cookies for the |
| 175 // given origin. | 175 // given origin. |
| 176 // Only used if the very experimental --enable-strict-site-isolation or | 176 // Only used if the very experimental --enable-strict-site-isolation or |
| 177 // --site-per-process flags are used. | 177 // --site-per-process flags are used. |
| 178 void LockToOrigin(int child_id, const GURL& gurl); | 178 void LockToOrigin(int child_id, const GURL& gurl); |
| 179 | 179 |
| 180 // Determines if certain permissions were granted for a file fystem. | 180 // Determines if certain permissions were granted for a file fystem. |
| 181 // |permissions| must be a bitwise-or'd value of base::PlatformFileFlags. | 181 // |permissions| must be a bitwise-or'd value of |
| 182 // ChildProcessSecurityPermissions. | |
|
Tom Sepez
2013/11/11 18:28:34
Thanks for taking a stab at fixing this comment.
qinmin
2013/11/11 20:49:53
Done. crbug/317814 filed to track this.
On 2013/1
| |
| 182 bool HasPermissionsForFileSystem( | 183 bool HasPermissionsForFileSystem( |
| 183 int child_id, | 184 int child_id, |
| 184 const std::string& filesystem_id, | 185 const std::string& filesystem_id, |
| 185 int permission); | 186 int permission); |
| 186 | 187 |
| 187 // Register FileSystem type and permission policy which should be used | 188 // Register FileSystem type and permission policy which should be used |
| 188 // for the type. The |policy| must be a bitwise-or'd value of | 189 // for the type. The |policy| must be a bitwise-or'd value of |
| 189 // fileapi::FilePermissionPolicy. | 190 // fileapi::FilePermissionPolicy. |
| 190 void RegisterFileSystemPermissionPolicy( | 191 void RegisterFileSystemPermissionPolicy( |
| 191 fileapi::FileSystemType type, | 192 fileapi::FileSystemType type, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 210 | 211 |
| 211 // Obtain an instance of ChildProcessSecurityPolicyImpl via GetInstance(). | 212 // Obtain an instance of ChildProcessSecurityPolicyImpl via GetInstance(). |
| 212 ChildProcessSecurityPolicyImpl(); | 213 ChildProcessSecurityPolicyImpl(); |
| 213 friend struct DefaultSingletonTraits<ChildProcessSecurityPolicyImpl>; | 214 friend struct DefaultSingletonTraits<ChildProcessSecurityPolicyImpl>; |
| 214 | 215 |
| 215 // Adds child process during registration. | 216 // Adds child process during registration. |
| 216 void AddChild(int child_id); | 217 void AddChild(int child_id); |
| 217 | 218 |
| 218 // Determines if certain permissions were granted for a file to given child | 219 // Determines if certain permissions were granted for a file to given child |
| 219 // process. |permissions| must be a bitwise-or'd value of | 220 // process. |permissions| must be a bitwise-or'd value of |
| 220 // base::PlatformFileFlags. | 221 // ChildProcessSecurityPermissions. |
| 221 bool ChildProcessHasPermissionsForFile(int child_id, | 222 bool ChildProcessHasPermissionsForFile(int child_id, |
| 222 const base::FilePath& file, | 223 const base::FilePath& file, |
| 223 int permissions); | 224 int permissions); |
| 224 | 225 |
| 225 // Grant a particular permission set for a file. |permissions| is a bit-set | 226 // Grant a particular permission set for a file. |permissions| is a bit-set |
| 226 // of base::PlatformFileFlags. | 227 // of ChildProcessSecurityPermissions. |
| 227 void GrantPermissionsForFile(int child_id, | 228 void GrantPermissionsForFile(int child_id, |
| 228 const base::FilePath& file, | 229 const base::FilePath& file, |
| 229 int permissions); | 230 int permissions); |
| 230 | 231 |
| 231 // Grants access permission to the given isolated file system | 232 // Grants access permission to the given isolated file system |
| 232 // identified by |filesystem_id|. See comments for | 233 // identified by |filesystem_id|. See comments for |
| 233 // ChildProcessSecurityPolicy::GrantReadFileSystem() for more details. | 234 // ChildProcessSecurityPolicy::GrantReadFileSystem() for more details. |
| 234 void GrantPermissionsForFileSystem( | 235 void GrantPermissionsForFileSystem( |
| 235 int child_id, | 236 int child_id, |
| 236 const std::string& filesystem_id, | 237 const std::string& filesystem_id, |
| 237 int permission); | 238 int permission); |
| 238 | 239 |
| 239 // Deprecated: Use CanReadFile, etc. methods instead. | 240 // Deprecated: Use CanReadFile, etc. methods instead. |
| 240 // Determines if certain permissions were granted for a file. |permissions| | 241 // Determines if certain permissions were granted for a file. |permissions| |
| 241 // must be a bitwise-or'd value of base::PlatformFileFlags. | 242 // must be a bitwise-or'd value of ChildProcessSecurityPermissions. |
| 242 bool HasPermissionsForFile(int child_id, | 243 bool HasPermissionsForFile(int child_id, |
| 243 const base::FilePath& file, | 244 const base::FilePath& file, |
| 244 int permissions); | 245 int permissions); |
| 245 | 246 |
| 246 // Deprecated: Use CanReadFileSystemFile, etc. methods instead. | 247 // Deprecated: Use CanReadFileSystemFile, etc. methods instead. |
| 247 // Determines if certain permissions were granted for a file in FileSystem | 248 // Determines if certain permissions were granted for a file in FileSystem |
| 248 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags. | 249 // API. |permissions| must be a bitwise-or'd value of |
| 250 // ChildProcessSecurityPermissions. | |
| 249 bool HasPermissionsForFileSystemFile(int child_id, | 251 bool HasPermissionsForFileSystemFile(int child_id, |
| 250 const fileapi::FileSystemURL& url, | 252 const fileapi::FileSystemURL& url, |
| 251 int permissions); | 253 int permissions); |
| 252 | 254 |
| 253 // You must acquire this lock before reading or writing any members of this | 255 // You must acquire this lock before reading or writing any members of this |
| 254 // class. You must not block while holding this lock. | 256 // class. You must not block while holding this lock. |
| 255 base::Lock lock_; | 257 base::Lock lock_; |
| 256 | 258 |
| 257 // These schemes are white-listed for all child processes. This set is | 259 // These schemes are white-listed for all child processes. This set is |
| 258 // protected by |lock_|. | 260 // protected by |lock_|. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 274 WorkerToMainProcessMap worker_map_; | 276 WorkerToMainProcessMap worker_map_; |
| 275 | 277 |
| 276 FileSystemPermissionPolicyMap file_system_policy_map_; | 278 FileSystemPermissionPolicyMap file_system_policy_map_; |
| 277 | 279 |
| 278 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); | 280 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 } // namespace content | 283 } // namespace content |
| 282 | 284 |
| 283 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 285 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
| OLD | NEW |