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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 | 14 |
15 class FilePath; | 15 class FilePath; |
| 16 class GURL; |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 // The ChildProcessSecurityPolicy class is used to grant and revoke security | 20 // The ChildProcessSecurityPolicy class is used to grant and revoke security |
20 // capabilities for child processes. For example, it restricts whether a child | 21 // capabilities for child processes. For example, it restricts whether a child |
21 // process is permitted to load file:// URLs based on whether the process | 22 // process is permitted to load file:// URLs based on whether the process |
22 // has ever been commanded to load file:// URLs by the browser. | 23 // has ever been commanded to load file:// URLs by the browser. |
23 // | 24 // |
24 // ChildProcessSecurityPolicy is a singleton that may be used on any thread. | 25 // ChildProcessSecurityPolicy is a singleton that may be used on any thread. |
25 // | 26 // |
(...skipping 25 matching lines...) Expand all Loading... |
51 // base::PlatformFileFlags. | 52 // base::PlatformFileFlags. |
52 virtual void GrantPermissionsForFile(int child_id, | 53 virtual void GrantPermissionsForFile(int child_id, |
53 const FilePath& file, | 54 const FilePath& file, |
54 int permissions) = 0; | 55 int permissions) = 0; |
55 | 56 |
56 // Before servicing a child process's request to upload a file to the web, the | 57 // Before servicing a child process's request to upload a file to the web, the |
57 // browser should call this method to determine whether the process has the | 58 // browser should call this method to determine whether the process has the |
58 // capability to upload the requested file. | 59 // capability to upload the requested file. |
59 virtual bool CanReadFile(int child_id, const FilePath& file) = 0; | 60 virtual bool CanReadFile(int child_id, const FilePath& file) = 0; |
60 | 61 |
| 62 // Before servicing a child process's request for a URL, the browser should |
| 63 // call this method to determine whether the process has the capability to |
| 64 // request the URL. |
| 65 virtual bool CanRequestURL(int child_id, const GURL& url) = 0; |
| 66 |
61 // Whenever the user picks a file from a <input type="file"> element, the | 67 // Whenever the user picks a file from a <input type="file"> element, the |
62 // browser should call this function to grant the child process the capability | 68 // browser should call this function to grant the child process the capability |
63 // to upload the file to the web. | 69 // to upload the file to the web. |
64 virtual void GrantReadFile(int child_id, const FilePath& file) = 0; | 70 virtual void GrantReadFile(int child_id, const FilePath& file) = 0; |
65 | 71 |
66 // Grants access permission to the given filesystem_id. | 72 // Grants access permission to the given filesystem_id. |
67 virtual void GrantAccessFileSystem(int child_id, | 73 virtual void GrantAccessFileSystem(int child_id, |
68 const std::string& filesystem_id) = 0; | 74 const std::string& filesystem_id) = 0; |
69 | 75 |
70 // Grants the child process the capability to access URLs of the provided | 76 // Grants the child process the capability to access URLs of the provided |
71 // scheme. | 77 // scheme. |
72 virtual void GrantScheme(int child_id, const std::string& scheme) = 0; | 78 virtual void GrantScheme(int child_id, const std::string& scheme) = 0; |
73 }; | 79 }; |
74 | 80 |
75 }; // namespace content | 81 }; // namespace content |
76 | 82 |
77 #endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 83 #endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
OLD | NEW |