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

Side by Side Diff: content/public/browser/child_process_security_policy.h

Issue 19599006: ChildProcessSecurityPolicy: Deprecate bitmask-based permissions checks for files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 22 matching lines...) Expand all
33 static CONTENT_EXPORT ChildProcessSecurityPolicy* GetInstance(); 33 static CONTENT_EXPORT ChildProcessSecurityPolicy* GetInstance();
34 34
35 // Web-safe schemes can be requested by any child process. Once a web-safe 35 // Web-safe schemes can be requested by any child process. Once a web-safe
36 // scheme has been registered, any child process can request URLs with 36 // scheme has been registered, any child process can request URLs with
37 // that scheme. There is no mechanism for revoking web-safe schemes. 37 // that scheme. There is no mechanism for revoking web-safe schemes.
38 virtual void RegisterWebSafeScheme(const std::string& scheme) = 0; 38 virtual void RegisterWebSafeScheme(const std::string& scheme) = 0;
39 39
40 // Returns true iff |scheme| has been registered as a web-safe scheme. 40 // Returns true iff |scheme| has been registered as a web-safe scheme.
41 virtual bool IsWebSafeScheme(const std::string& scheme) = 0; 41 virtual bool IsWebSafeScheme(const std::string& scheme) = 0;
42 42
43 // Before servicing a child process's request to upload a file to the web, the 43 // This permission grants only read access to a file.
44 // browser should call this method to determine whether the process has the
45 // capability to upload the requested file.
46 virtual bool CanReadFile(int child_id, const base::FilePath& file) = 0;
47
48 // Whenever the user picks a file from a <input type="file"> element, the 44 // Whenever the user picks a file from a <input type="file"> element, the
49 // browser should call this function to grant the child process the capability 45 // browser should call this function to grant the child process the capability
50 // to upload the file to the web. Grants FILE_PERMISSION_READ_ONLY. 46 // to upload the file to the web. Grants FILE_PERMISSION_READ_ONLY.
51 virtual void GrantReadFile(int child_id, const base::FilePath& file) = 0; 47 virtual void GrantReadFile(int child_id, const base::FilePath& file) = 0;
52 48
53 // This permission grants creation, read, and full write access to a file, 49 // This permission grants creation, read, and full write access to a file,
54 // including attributes. 50 // including attributes.
55 virtual void GrantCreateReadWriteFile(int child_id, 51 virtual void GrantCreateReadWriteFile(int child_id,
56 const base::FilePath& file) = 0; 52 const base::FilePath& file) = 0;
57 53
58 // This permission grants creation and write access to a file. 54 // This permission grants creation and write access to a file.
59 virtual void GrantCreateWriteFile(int child_id, 55 virtual void GrantCreateWriteFile(int child_id,
60 const base::FilePath& file) = 0; 56 const base::FilePath& file) = 0;
61 57
58 // These methods verify whether or not the child process has been granted
59 // permissions perform these functions on |file|.
60
61 // Before servicing a child process's request to upload a file to the web, the
62 // browser should call this method to determine whether the process has the
63 // capability to upload the requested file.
64 virtual bool CanReadFile(int child_id, const base::FilePath& file) = 0;
65 virtual bool CanWriteFile(int child_id, const base::FilePath& file) = 0;
66 virtual bool CanCreateFile(int child_id, const base::FilePath& file) = 0;
67 virtual bool CanCreateWriteFile(int child_id, const base::FilePath& file) = 0;
68
62 // Grants read access permission to the given isolated file system 69 // Grants read access permission to the given isolated file system
63 // identified by |filesystem_id|. An isolated file system can be 70 // identified by |filesystem_id|. An isolated file system can be
64 // created for a set of native files/directories (like dropped files) 71 // created for a set of native files/directories (like dropped files)
65 // using fileapi::IsolatedContext. A child process needs to be granted 72 // using fileapi::IsolatedContext. A child process needs to be granted
66 // permission to the file system to access the files in it using 73 // permission to the file system to access the files in it using
67 // file system URL. 74 // file system URL.
68 // 75 //
69 // Note: to grant read access to the content of files you also need 76 // Note: to grant read access to the content of files you also need
70 // to give permission directly to the file paths using GrantReadFile. 77 // to give permission directly to the file paths using GrantReadFile.
71 // TODO(kinuko): We should unify this file-level and file-system-level 78 // TODO(kinuko): We should unify this file-level and file-system-level
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 117
111 // Returns true iff read and write access has been granted to the filesystem 118 // Returns true iff read and write access has been granted to the filesystem
112 // with |filesystem_id|. 119 // with |filesystem_id|.
113 virtual bool CanReadWriteFileSystem(int child_id, 120 virtual bool CanReadWriteFileSystem(int child_id,
114 const std::string& filesystem_id) = 0; 121 const std::string& filesystem_id) = 0;
115 }; 122 };
116 123
117 }; // namespace content 124 }; // namespace content
118 125
119 #endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ 126 #endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698