| 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 #pragma once | 8 #pragma once |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // ChildProcessSecurityPolicy implementation. | 32 // ChildProcessSecurityPolicy implementation. |
| 33 virtual void RegisterWebSafeScheme(const std::string& scheme) OVERRIDE; | 33 virtual void RegisterWebSafeScheme(const std::string& scheme) OVERRIDE; |
| 34 virtual bool IsWebSafeScheme(const std::string& scheme) OVERRIDE; | 34 virtual bool IsWebSafeScheme(const std::string& scheme) OVERRIDE; |
| 35 virtual void RegisterDisabledSchemes(const std::set<std::string>& schemes) | 35 virtual void RegisterDisabledSchemes(const std::set<std::string>& schemes) |
| 36 OVERRIDE; | 36 OVERRIDE; |
| 37 virtual void GrantPermissionsForFile(int child_id, | 37 virtual void GrantPermissionsForFile(int child_id, |
| 38 const FilePath& file, | 38 const FilePath& file, |
| 39 int permissions) OVERRIDE; | 39 int permissions) OVERRIDE; |
| 40 virtual void GrantReadFile(int child_id, const FilePath& file) OVERRIDE; | 40 virtual void GrantReadFile(int child_id, const FilePath& file) OVERRIDE; |
| 41 virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE; | 41 virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE; |
| 42 virtual void GrantAccessFileSystem(int child_id, |
| 43 const std::string& filesystem_id) OVERRIDE; |
| 44 virtual bool CanReadFile(int child_id, const FilePath& file) OVERRIDE; |
| 42 | 45 |
| 43 // Pseudo schemes are treated differently than other schemes because they | 46 // Pseudo schemes are treated differently than other schemes because they |
| 44 // cannot be requested like normal URLs. There is no mechanism for revoking | 47 // cannot be requested like normal URLs. There is no mechanism for revoking |
| 45 // pseudo schemes. | 48 // pseudo schemes. |
| 46 void RegisterPseudoScheme(const std::string& scheme); | 49 void RegisterPseudoScheme(const std::string& scheme); |
| 47 | 50 |
| 48 // Returns true iff |scheme| has been registered as pseudo scheme. | 51 // Returns true iff |scheme| has been registered as pseudo scheme. |
| 49 bool IsPseudoScheme(const std::string& scheme); | 52 bool IsPseudoScheme(const std::string& scheme); |
| 50 | 53 |
| 51 // Returns true iff |scheme| is listed as a disabled scheme. | 54 // Returns true iff |scheme| is listed as a disabled scheme. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 70 // request the URL. | 73 // request the URL. |
| 71 void GrantRequestURL(int child_id, const GURL& url); | 74 void GrantRequestURL(int child_id, const GURL& url); |
| 72 | 75 |
| 73 // Grants the child process permission to enumerate all the files in | 76 // Grants the child process permission to enumerate all the files in |
| 74 // this directory and read those files. | 77 // this directory and read those files. |
| 75 void GrantReadDirectory(int child_id, const FilePath& directory); | 78 void GrantReadDirectory(int child_id, const FilePath& directory); |
| 76 | 79 |
| 77 // Revokes all permissions granted to the given file. | 80 // Revokes all permissions granted to the given file. |
| 78 void RevokeAllPermissionsForFile(int child_id, const FilePath& file); | 81 void RevokeAllPermissionsForFile(int child_id, const FilePath& file); |
| 79 | 82 |
| 80 // Grants access permission to the given filesystem_id. | |
| 81 void GrantAccessFileSystem(int child_id, const std::string& filesystem_id); | |
| 82 | |
| 83 // Grant the child process the ability to use Web UI Bindings. | 83 // Grant the child process the ability to use Web UI Bindings. |
| 84 void GrantWebUIBindings(int child_id); | 84 void GrantWebUIBindings(int child_id); |
| 85 | 85 |
| 86 // Grant the child process the ability to read raw cookies. | 86 // Grant the child process the ability to read raw cookies. |
| 87 void GrantReadRawCookies(int child_id); | 87 void GrantReadRawCookies(int child_id); |
| 88 | 88 |
| 89 // Revoke read raw cookies permission. | 89 // Revoke read raw cookies permission. |
| 90 void RevokeReadRawCookies(int child_id); | 90 void RevokeReadRawCookies(int child_id); |
| 91 | 91 |
| 92 // Before servicing a child process's request for a URL, the browser should | 92 // Before servicing a child process's request for a URL, the browser should |
| 93 // call this method to determine whether the process has the capability to | 93 // call this method to determine whether the process has the capability to |
| 94 // request the URL. | 94 // request the URL. |
| 95 bool CanRequestURL(int child_id, const GURL& url); | 95 bool CanRequestURL(int child_id, const GURL& url); |
| 96 | 96 |
| 97 // Before servicing a child process's request to upload a file to the web, the | |
| 98 // browser should call this method to determine whether the process has the | |
| 99 // capability to upload the requested file. | |
| 100 bool CanReadFile(int child_id, const FilePath& file); | |
| 101 | |
| 102 // Before servicing a child process's request to enumerate a directory | 97 // Before servicing a child process's request to enumerate a directory |
| 103 // the browser should call this method to check for the capability. | 98 // the browser should call this method to check for the capability. |
| 104 bool CanReadDirectory(int child_id, const FilePath& directory); | 99 bool CanReadDirectory(int child_id, const FilePath& directory); |
| 105 | 100 |
| 106 // Determines if certain permissions were granted for a file. |permissions| | 101 // Determines if certain permissions were granted for a file. |permissions| |
| 107 // must be a bit-set of base::PlatformFileFlags. | 102 // must be a bit-set of base::PlatformFileFlags. |
| 108 bool HasPermissionsForFile(int child_id, | 103 bool HasPermissionsForFile(int child_id, |
| 109 const FilePath& file, | 104 const FilePath& file, |
| 110 int permissions); | 105 int permissions); |
| 111 | 106 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 SecurityStateMap security_state_; | 172 SecurityStateMap security_state_; |
| 178 | 173 |
| 179 // This maps keeps the record of which js worker thread child process | 174 // This maps keeps the record of which js worker thread child process |
| 180 // corresponds to which main js thread child process. | 175 // corresponds to which main js thread child process. |
| 181 WorkerToMainProcessMap worker_map_; | 176 WorkerToMainProcessMap worker_map_; |
| 182 | 177 |
| 183 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); | 178 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); |
| 184 }; | 179 }; |
| 185 | 180 |
| 186 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 181 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
| OLD | NEW |