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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 virtual bool CanReadFileSystem(int child_id, | 67 virtual bool CanReadFileSystem(int child_id, |
| 68 const std::string& filesystem_id) OVERRIDE; | 68 const std::string& filesystem_id) OVERRIDE; |
| 69 virtual bool CanReadWriteFileSystem( | 69 virtual bool CanReadWriteFileSystem( |
| 70 int child_id, | 70 int child_id, |
| 71 const std::string& filesystem_id) OVERRIDE; | 71 const std::string& filesystem_id) OVERRIDE; |
| 72 virtual bool CanCopyIntoFileSystem(int child_id, | 72 virtual bool CanCopyIntoFileSystem(int child_id, |
| 73 const std::string& filesystem_id) OVERRIDE; | 73 const std::string& filesystem_id) OVERRIDE; |
| 74 virtual bool CanDeleteFromFileSystem( | 74 virtual bool CanDeleteFromFileSystem( |
| 75 int child_id, | 75 int child_id, |
| 76 const std::string& filesystem_id) OVERRIDE; | 76 const std::string& filesystem_id) OVERRIDE; |
| 77 #if defined(OS_ANDROID) | |
| 78 virtual void GrantReadContentUrl(int child_id, | |
| 79 const GURL& content_url) OVERRIDE; | |
| 80 virtual bool CanReadContentUrl(int child_id, | |
| 81 const GURL& content_url) OVERRIDE; | |
| 82 #endif | |
| 77 | 83 |
| 78 // Pseudo schemes are treated differently than other schemes because they | 84 // Pseudo schemes are treated differently than other schemes because they |
| 79 // cannot be requested like normal URLs. There is no mechanism for revoking | 85 // cannot be requested like normal URLs. There is no mechanism for revoking |
| 80 // pseudo schemes. | 86 // pseudo schemes. |
| 81 void RegisterPseudoScheme(const std::string& scheme); | 87 void RegisterPseudoScheme(const std::string& scheme); |
| 82 | 88 |
| 83 // Returns true iff |scheme| has been registered as pseudo scheme. | 89 // Returns true iff |scheme| has been registered as pseudo scheme. |
| 84 bool IsPseudoScheme(const std::string& scheme); | 90 bool IsPseudoScheme(const std::string& scheme); |
| 85 | 91 |
| 86 // Upon creation, child processes should register themselves by calling this | 92 // Upon creation, child processes should register themselves by calling this |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 const base::FilePath& file, | 245 const base::FilePath& file, |
| 240 int permissions); | 246 int permissions); |
| 241 | 247 |
| 242 // Deprecated: Use CanReadFileSystemFile, etc. methods instead. | 248 // Deprecated: Use CanReadFileSystemFile, etc. methods instead. |
| 243 // Determines if certain permissions were granted for a file in FileSystem | 249 // Determines if certain permissions were granted for a file in FileSystem |
| 244 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags. | 250 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags. |
| 245 bool HasPermissionsForFileSystemFile(int child_id, | 251 bool HasPermissionsForFileSystemFile(int child_id, |
| 246 const fileapi::FileSystemURL& url, | 252 const fileapi::FileSystemURL& url, |
| 247 int permissions); | 253 int permissions); |
| 248 | 254 |
| 255 #if defined(OS_ANDROID) | |
| 256 // Grant a particular permission set for a content url. |permissions| is a | |
| 257 // bit-set of base::PlatformFileFlags. | |
|
kinuko
2013/10/29 02:52:31
nit: we no longer use base::PlatformFileFlags for
qinmin
2013/10/29 19:14:21
Done.
| |
| 258 void GrantPermissionsForContentUrl(int child_id, | |
| 259 const GURL& content_url, | |
| 260 int permissions); | |
| 261 | |
| 262 // Determines if certain permissions were granted for a content url to given | |
| 263 // child process. |permissions| must be a bitwise-or'd value of | |
| 264 // base::PlatformFileFlags. | |
| 265 bool ChildProcessHasPermissionsForContentUrl(int child_id, | |
| 266 const GURL& content_url, | |
| 267 int permissions); | |
| 268 #endif | |
| 269 | |
| 249 // You must acquire this lock before reading or writing any members of this | 270 // You must acquire this lock before reading or writing any members of this |
| 250 // class. You must not block while holding this lock. | 271 // class. You must not block while holding this lock. |
| 251 base::Lock lock_; | 272 base::Lock lock_; |
| 252 | 273 |
| 253 // These schemes are white-listed for all child processes. This set is | 274 // These schemes are white-listed for all child processes. This set is |
| 254 // protected by |lock_|. | 275 // protected by |lock_|. |
| 255 SchemeSet web_safe_schemes_; | 276 SchemeSet web_safe_schemes_; |
| 256 | 277 |
| 257 // These schemes do not actually represent retrievable URLs. For example, | 278 // These schemes do not actually represent retrievable URLs. For example, |
| 258 // the the URLs in the "about" scheme are aliases to other URLs. This set is | 279 // the the URLs in the "about" scheme are aliases to other URLs. This set is |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 270 WorkerToMainProcessMap worker_map_; | 291 WorkerToMainProcessMap worker_map_; |
| 271 | 292 |
| 272 FileSystemPermissionPolicyMap file_system_policy_map_; | 293 FileSystemPermissionPolicyMap file_system_policy_map_; |
| 273 | 294 |
| 274 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); | 295 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); |
| 275 }; | 296 }; |
| 276 | 297 |
| 277 } // namespace content | 298 } // namespace content |
| 278 | 299 |
| 279 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 300 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
| OLD | NEW |