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

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

Issue 19599006: ChildProcessSecurityPolicy: Deprecate bitmask-based permissions checks for files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address vandebo comments Created 7 years, 5 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
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 26 matching lines...) Expand all
37 // private. 37 // private.
38 virtual ~ChildProcessSecurityPolicyImpl(); 38 virtual ~ChildProcessSecurityPolicyImpl();
39 39
40 static ChildProcessSecurityPolicyImpl* GetInstance(); 40 static ChildProcessSecurityPolicyImpl* GetInstance();
41 41
42 // ChildProcessSecurityPolicy implementation. 42 // ChildProcessSecurityPolicy implementation.
43 virtual void RegisterWebSafeScheme(const std::string& scheme) OVERRIDE; 43 virtual void RegisterWebSafeScheme(const std::string& scheme) OVERRIDE;
44 virtual bool IsWebSafeScheme(const std::string& scheme) OVERRIDE; 44 virtual bool IsWebSafeScheme(const std::string& scheme) OVERRIDE;
45 virtual void GrantReadFile(int child_id, const base::FilePath& file) OVERRIDE; 45 virtual void GrantReadFile(int child_id, const base::FilePath& file) OVERRIDE;
46 virtual void GrantCreateReadWriteFile(int child_id, 46 virtual void GrantCreateReadWriteFile(int child_id,
47 const base::FilePath& file) OVERRIDE; 47 const base::FilePath& file) OVERRIDE;
48 virtual void GrantCreateWriteFile(int child_id, 48 virtual void GrantCreateWriteFile(int child_id,
49 const base::FilePath& file) OVERRIDE; 49 const base::FilePath& file) OVERRIDE;
50 virtual void GrantReadFileSystem( 50 virtual void GrantReadFileSystem(
51 int child_id, 51 int child_id,
52 const std::string& filesystem_id) OVERRIDE; 52 const std::string& filesystem_id) OVERRIDE;
53 virtual void GrantWriteFileSystem( 53 virtual void GrantWriteFileSystem(
54 int child_id, 54 int child_id,
55 const std::string& filesystem_id) OVERRIDE; 55 const std::string& filesystem_id) OVERRIDE;
56 virtual void GrantCreateFileForFileSystem( 56 virtual void GrantCreateFileForFileSystem(
57 int child_id, 57 int child_id,
58 const std::string& filesystem_id) OVERRIDE; 58 const std::string& filesystem_id) OVERRIDE;
59 virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE; 59 virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE;
60 virtual bool CanReadFile(int child_id, const base::FilePath& file) OVERRIDE; 60 virtual bool CanReadFile(int child_id, const base::FilePath& file) OVERRIDE;
61 virtual bool CanWriteFile(int child_id, const base::FilePath& file) OVERRIDE;
62 virtual bool CanCreateFile(int child_id, const base::FilePath& file) OVERRIDE;
63 virtual bool CanCreateReadWriteFile(int child_id,
64 const base::FilePath& file) OVERRIDE;
61 virtual bool CanReadFileSystem(int child_id, 65 virtual bool CanReadFileSystem(int child_id,
62 const std::string& filesystem_id) OVERRIDE; 66 const std::string& filesystem_id) OVERRIDE;
63 virtual bool CanReadWriteFileSystem( 67 virtual bool CanReadWriteFileSystem(
64 int child_id, 68 int child_id,
65 const std::string& filesystem_id) OVERRIDE; 69 const std::string& filesystem_id) OVERRIDE;
66 70
67 // Pseudo schemes are treated differently than other schemes because they 71 // Pseudo schemes are treated differently than other schemes because they
68 // cannot be requested like normal URLs. There is no mechanism for revoking 72 // cannot be requested like normal URLs. There is no mechanism for revoking
69 // pseudo schemes. 73 // pseudo schemes.
70 void RegisterPseudoScheme(const std::string& scheme); 74 void RegisterPseudoScheme(const std::string& scheme);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // the given origin in main frames or subframes. 126 // the given origin in main frames or subframes.
123 // Only might return false if --site-per-process flag is used. 127 // Only might return false if --site-per-process flag is used.
124 bool CanLoadPage(int child_id, 128 bool CanLoadPage(int child_id,
125 const GURL& url, 129 const GURL& url,
126 ResourceType::Type resource_type); 130 ResourceType::Type resource_type);
127 131
128 // Before servicing a child process's request to enumerate a directory 132 // Before servicing a child process's request to enumerate a directory
129 // the browser should call this method to check for the capability. 133 // the browser should call this method to check for the capability.
130 bool CanReadDirectory(int child_id, const base::FilePath& directory); 134 bool CanReadDirectory(int child_id, const base::FilePath& directory);
131 135
136 // Deprecated: Use CanReadFile, etc. methods instead.
132 // Determines if certain permissions were granted for a file. |permissions| 137 // Determines if certain permissions were granted for a file. |permissions|
133 // must be a bitwise-or'd value of base::PlatformFileFlags. 138 // must be a bitwise-or'd value of base::PlatformFileFlags.
134 bool HasPermissionsForFile(int child_id, 139 bool HasPermissionsForFile(int child_id,
135 const base::FilePath& file, 140 const base::FilePath& file,
136 int permissions); 141 int permissions);
137 142
143 // Deprecated: Use CanReadFileSystemFile, etc. methods instead.
138 // Determines if certain permissions were granted for a file in FileSystem 144 // Determines if certain permissions were granted for a file in FileSystem
139 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags. 145 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags.
140 bool HasPermissionsForFileSystemFile(int child_id, 146 bool HasPermissionsForFileSystemFile(int child_id,
141 const fileapi::FileSystemURL& url, 147 const fileapi::FileSystemURL& url,
142 int permissions); 148 int permissions);
143 149
150 // Explicit permissions checks for FileSystemURL specified files.
151 bool CanReadFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
152 bool CanWriteFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
153 bool CanCreateFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
154 bool CanCreateReadWriteFileSystemFile(int child_id,
155 const fileapi::FileSystemURL& url);
156
144 // Returns true if the specified child_id has been granted WebUIBindings. 157 // Returns true if the specified child_id has been granted WebUIBindings.
145 // The browser should check this property before assuming the child process is 158 // The browser should check this property before assuming the child process is
146 // allowed to use WebUIBindings. 159 // allowed to use WebUIBindings.
147 bool HasWebUIBindings(int child_id); 160 bool HasWebUIBindings(int child_id);
148 161
149 // Returns true if the specified child_id has been granted ReadRawCookies. 162 // Returns true if the specified child_id has been granted ReadRawCookies.
150 bool CanReadRawCookies(int child_id); 163 bool CanReadRawCookies(int child_id);
151 164
152 // Returns true if the process is permitted to read and modify the cookies for 165 // Returns true if the process is permitted to read and modify the cookies for
153 // the given origin. Does not affect cookies attached to or set by network 166 // the given origin. Does not affect cookies attached to or set by network
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 WorkerToMainProcessMap worker_map_; 260 WorkerToMainProcessMap worker_map_;
248 261
249 FileSystemPermissionPolicyMap file_system_policy_map_; 262 FileSystemPermissionPolicyMap file_system_policy_map_;
250 263
251 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); 264 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl);
252 }; 265 };
253 266
254 } // namespace content 267 } // namespace content
255 268
256 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 269 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698