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

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: Also add FileSystemURL based methods. 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 24 matching lines...) Expand all
35 public: 35 public:
36 // Object can only be created through GetInstance() so the constructor is 36 // Object can only be created through GetInstance() so the constructor is
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;
46 virtual void GrantCreateReadWriteFile(int child_id,
47 const base::FilePath& file) OVERRIDE;
48 virtual void GrantCreateWriteFile(int child_id,
49 const base::FilePath& file) OVERRIDE;
50 virtual void GrantReadFileSystem( 45 virtual void GrantReadFileSystem(
51 int child_id, 46 int child_id,
52 const std::string& filesystem_id) OVERRIDE; 47 const std::string& filesystem_id) OVERRIDE;
53 virtual void GrantWriteFileSystem( 48 virtual void GrantWriteFileSystem(
54 int child_id, 49 int child_id,
55 const std::string& filesystem_id) OVERRIDE; 50 const std::string& filesystem_id) OVERRIDE;
56 virtual void GrantCreateFileForFileSystem( 51 virtual void GrantCreateFileForFileSystem(
57 int child_id, 52 int child_id,
58 const std::string& filesystem_id) OVERRIDE; 53 const std::string& filesystem_id) OVERRIDE;
59 virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE; 54 virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE;
60 virtual bool CanReadFile(int child_id, const base::FilePath& file) OVERRIDE; 55 virtual bool CanReadFile(int child_id, const base::FilePath& file) OVERRIDE;
vandebo (ex-Chrome) 2013/07/17 21:54:27 File stuff is probably more generally interesting
tommycli 2013/07/17 22:31:11 Done.
56 virtual bool CanWriteFile(int child_id, const base::FilePath& file) OVERRIDE;
57 virtual bool CanCreateFile(int child_id, const base::FilePath& file) OVERRIDE;
58 virtual bool CanCreateReadWriteFile(int child_id,
59 const base::FilePath& file) OVERRIDE;
60 virtual void GrantReadFile(int child_id, const base::FilePath& file) OVERRIDE;
61 virtual void GrantWriteFile(int child_id,
62 const base::FilePath& file) OVERRIDE;
63 virtual void GrantCreateFile(int child_id,
64 const base::FilePath& file) OVERRIDE;
65 virtual void GrantCreateReadWriteFile(int child_id,
66 const base::FilePath& file) OVERRIDE;
67 virtual void GrantCreateWriteFile(int child_id,
68 const base::FilePath& file) OVERRIDE;
61 virtual bool CanReadFileSystem(int child_id, 69 virtual bool CanReadFileSystem(int child_id,
62 const std::string& filesystem_id) OVERRIDE; 70 const std::string& filesystem_id) OVERRIDE;
63 virtual bool CanReadWriteFileSystem( 71 virtual bool CanReadWriteFileSystem(
64 int child_id, 72 int child_id,
65 const std::string& filesystem_id) OVERRIDE; 73 const std::string& filesystem_id) OVERRIDE;
66 74
67 // Pseudo schemes are treated differently than other schemes because they 75 // Pseudo schemes are treated differently than other schemes because they
68 // cannot be requested like normal URLs. There is no mechanism for revoking 76 // cannot be requested like normal URLs. There is no mechanism for revoking
69 // pseudo schemes. 77 // pseudo schemes.
70 void RegisterPseudoScheme(const std::string& scheme); 78 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. 130 // the given origin in main frames or subframes.
123 // Only might return false if --site-per-process flag is used. 131 // Only might return false if --site-per-process flag is used.
124 bool CanLoadPage(int child_id, 132 bool CanLoadPage(int child_id,
125 const GURL& url, 133 const GURL& url,
126 ResourceType::Type resource_type); 134 ResourceType::Type resource_type);
127 135
128 // Before servicing a child process's request to enumerate a directory 136 // Before servicing a child process's request to enumerate a directory
129 // the browser should call this method to check for the capability. 137 // the browser should call this method to check for the capability.
130 bool CanReadDirectory(int child_id, const base::FilePath& directory); 138 bool CanReadDirectory(int child_id, const base::FilePath& directory);
131 139
140 // Deprecated: Use CanReadFile, etc. methods instead.
vandebo (ex-Chrome) 2013/07/17 21:54:27 I presume these will go away by the time you're do
tommycli 2013/07/17 22:31:11 Yes these will go away... after a long time.
132 // Determines if certain permissions were granted for a file. |permissions| 141 // Determines if certain permissions were granted for a file. |permissions|
133 // must be a bitwise-or'd value of base::PlatformFileFlags. 142 // must be a bitwise-or'd value of base::PlatformFileFlags.
134 bool HasPermissionsForFile(int child_id, 143 bool HasPermissionsForFile(int child_id,
135 const base::FilePath& file, 144 const base::FilePath& file,
136 int permissions); 145 int permissions);
137 146
147 // Deprecated: Use CanReadFileSystemFile, etc. methods instead.
138 // Determines if certain permissions were granted for a file in FileSystem 148 // Determines if certain permissions were granted for a file in FileSystem
139 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags. 149 // API. |permissions| must be a bitwise-or'd value of base::PlatformFileFlags.
140 bool HasPermissionsForFileSystemFile(int child_id, 150 bool HasPermissionsForFileSystemFile(int child_id,
141 const fileapi::FileSystemURL& url, 151 const fileapi::FileSystemURL& url,
142 int permissions); 152 int permissions);
143 153
154 // Explicit permissions checks for FileSystemURL specified files.
155 bool CanReadFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
156 bool CanWriteFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
157 bool CanCreateFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
158 bool CanCreateReadWriteFileSystemFile(int child_id,
159 const fileapi::FileSystemURL& url);
160
144 // Returns true if the specified child_id has been granted WebUIBindings. 161 // Returns true if the specified child_id has been granted WebUIBindings.
145 // The browser should check this property before assuming the child process is 162 // The browser should check this property before assuming the child process is
146 // allowed to use WebUIBindings. 163 // allowed to use WebUIBindings.
147 bool HasWebUIBindings(int child_id); 164 bool HasWebUIBindings(int child_id);
148 165
149 // Returns true if the specified child_id has been granted ReadRawCookies. 166 // Returns true if the specified child_id has been granted ReadRawCookies.
150 bool CanReadRawCookies(int child_id); 167 bool CanReadRawCookies(int child_id);
151 168
152 // Returns true if the process is permitted to read and modify the cookies for 169 // 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 170 // 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_; 264 WorkerToMainProcessMap worker_map_;
248 265
249 FileSystemPermissionPolicyMap file_system_policy_map_; 266 FileSystemPermissionPolicyMap file_system_policy_map_;
250 267
251 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); 268 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl);
252 }; 269 };
253 270
254 } // namespace content 271 } // namespace content
255 272
256 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 273 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698