Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: content/browser/child_process_security_policy_impl.h

Issue 23760004: ChildProcessSecurityPolicy: Port FileAPIMessageFilter to use new checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/child_process_security_policy_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // the given origin in main frames or subframes. 134 // the given origin in main frames or subframes.
135 // Only might return false if --site-per-process flag is used. 135 // Only might return false if --site-per-process flag is used.
136 bool CanLoadPage(int child_id, 136 bool CanLoadPage(int child_id,
137 const GURL& url, 137 const GURL& url,
138 ResourceType::Type resource_type); 138 ResourceType::Type resource_type);
139 139
140 // Before servicing a child process's request to enumerate a directory 140 // Before servicing a child process's request to enumerate a directory
141 // the browser should call this method to check for the capability. 141 // the browser should call this method to check for the capability.
142 bool CanReadDirectory(int child_id, const base::FilePath& directory); 142 bool CanReadDirectory(int child_id, const base::FilePath& directory);
143 143
144 // Deprecated: Use CanReadFile, etc. methods instead.
145 // Determines if certain permissions were granted for a file. |permissions|
146 // must be a bitwise-or'd value of base::PlatformFileFlags.
147 bool HasPermissionsForFile(int child_id,
148 const base::FilePath& file,
149 int permissions);
150
151 // Deprecated: Use CanReadFileSystemFile, etc. methods instead.
152 // Determines if certain permissions were granted for a file in FileSystem
153 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags.
154 bool HasPermissionsForFileSystemFile(int child_id,
155 const fileapi::FileSystemURL& url,
156 int permissions);
157
158 // Explicit permissions checks for FileSystemURL specified files. 144 // Explicit permissions checks for FileSystemURL specified files.
159 bool CanReadFileSystemFile(int child_id, const fileapi::FileSystemURL& url); 145 bool CanReadFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
160 bool CanWriteFileSystemFile(int child_id, const fileapi::FileSystemURL& url); 146 bool CanWriteFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
161 bool CanCreateFileSystemFile(int child_id, const fileapi::FileSystemURL& url); 147 bool CanCreateFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
162 bool CanCreateWriteFileSystemFile(int child_id, 148 bool CanCreateWriteFileSystemFile(int child_id,
163 const fileapi::FileSystemURL& url); 149 const fileapi::FileSystemURL& url);
164 150
165 // Returns true if the specified child_id has been granted WebUIBindings. 151 // Returns true if the specified child_id has been granted WebUIBindings.
166 // The browser should check this property before assuming the child process is 152 // The browser should check this property before assuming the child process is
167 // allowed to use WebUIBindings. 153 // allowed to use WebUIBindings.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 int policy); 190 int policy);
205 191
206 // Returns true if sending system exclusive messages is allowed. 192 // Returns true if sending system exclusive messages is allowed.
207 bool CanSendMIDISysExMessage(int child_id); 193 bool CanSendMIDISysExMessage(int child_id);
208 194
209 private: 195 private:
210 friend class ChildProcessSecurityPolicyInProcessBrowserTest; 196 friend class ChildProcessSecurityPolicyInProcessBrowserTest;
211 friend class ChildProcessSecurityPolicyTest; 197 friend class ChildProcessSecurityPolicyTest;
212 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyInProcessBrowserTest, 198 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyInProcessBrowserTest,
213 NoLeak); 199 NoLeak);
200 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyTest, FilePermissions);
214 201
215 class SecurityState; 202 class SecurityState;
216 203
217 typedef std::set<std::string> SchemeSet; 204 typedef std::set<std::string> SchemeSet;
218 typedef std::map<int, SecurityState*> SecurityStateMap; 205 typedef std::map<int, SecurityState*> SecurityStateMap;
219 typedef std::map<int, int> WorkerToMainProcessMap; 206 typedef std::map<int, int> WorkerToMainProcessMap;
220 typedef std::map<fileapi::FileSystemType, int> FileSystemPermissionPolicyMap; 207 typedef std::map<fileapi::FileSystemType, int> FileSystemPermissionPolicyMap;
221 208
222 // Obtain an instance of ChildProcessSecurityPolicyImpl via GetInstance(). 209 // Obtain an instance of ChildProcessSecurityPolicyImpl via GetInstance().
223 ChildProcessSecurityPolicyImpl(); 210 ChildProcessSecurityPolicyImpl();
(...skipping 16 matching lines...) Expand all
240 int permissions); 227 int permissions);
241 228
242 // Grants access permission to the given isolated file system 229 // Grants access permission to the given isolated file system
243 // identified by |filesystem_id|. See comments for 230 // identified by |filesystem_id|. See comments for
244 // ChildProcessSecurityPolicy::GrantReadFileSystem() for more details. 231 // ChildProcessSecurityPolicy::GrantReadFileSystem() for more details.
245 void GrantPermissionsForFileSystem( 232 void GrantPermissionsForFileSystem(
246 int child_id, 233 int child_id,
247 const std::string& filesystem_id, 234 const std::string& filesystem_id,
248 int permission); 235 int permission);
249 236
237 // Deprecated: Use CanReadFile, etc. methods instead.
238 // Determines if certain permissions were granted for a file. |permissions|
239 // must be a bitwise-or'd value of base::PlatformFileFlags.
240 bool HasPermissionsForFile(int child_id,
241 const base::FilePath& file,
242 int permissions);
243
244 // Deprecated: Use CanReadFileSystemFile, etc. methods instead.
245 // Determines if certain permissions were granted for a file in FileSystem
246 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags.
247 bool HasPermissionsForFileSystemFile(int child_id,
248 const fileapi::FileSystemURL& url,
249 int permissions);
250
250 // You must acquire this lock before reading or writing any members of this 251 // You must acquire this lock before reading or writing any members of this
251 // class. You must not block while holding this lock. 252 // class. You must not block while holding this lock.
252 base::Lock lock_; 253 base::Lock lock_;
253 254
254 // These schemes are white-listed for all child processes. This set is 255 // These schemes are white-listed for all child processes. This set is
255 // protected by |lock_|. 256 // protected by |lock_|.
256 SchemeSet web_safe_schemes_; 257 SchemeSet web_safe_schemes_;
257 258
258 // These schemes do not actually represent retrievable URLs. For example, 259 // These schemes do not actually represent retrievable URLs. For example,
259 // the the URLs in the "about" scheme are aliases to other URLs. This set is 260 // the the URLs in the "about" scheme are aliases to other URLs. This set is
(...skipping 11 matching lines...) Expand all
271 WorkerToMainProcessMap worker_map_; 272 WorkerToMainProcessMap worker_map_;
272 273
273 FileSystemPermissionPolicyMap file_system_policy_map_; 274 FileSystemPermissionPolicyMap file_system_policy_map_;
274 275
275 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); 276 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl);
276 }; 277 };
277 278
278 } // namespace content 279 } // namespace content
279 280
280 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 281 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/child_process_security_policy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698