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 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 17 matching lines...) Expand all Loading... |
28 class FileSystemURL; | 28 class FileSystemURL; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 class CONTENT_EXPORT ChildProcessSecurityPolicyImpl | 33 class CONTENT_EXPORT ChildProcessSecurityPolicyImpl |
34 : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) { | 34 : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) { |
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 ~ChildProcessSecurityPolicyImpl() override; |
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 void RegisterWebSafeScheme(const std::string& scheme) override; |
44 virtual bool IsWebSafeScheme(const std::string& scheme) override; | 44 bool IsWebSafeScheme(const std::string& scheme) override; |
45 virtual void GrantReadFile(int child_id, const base::FilePath& file) override; | 45 void GrantReadFile(int child_id, const base::FilePath& file) override; |
46 virtual void GrantCreateReadWriteFile(int child_id, | 46 void GrantCreateReadWriteFile(int child_id, |
47 const base::FilePath& file) override; | 47 const base::FilePath& file) override; |
48 virtual void GrantCopyInto(int child_id, const base::FilePath& dir) override; | 48 void GrantCopyInto(int child_id, const base::FilePath& dir) override; |
49 virtual void GrantDeleteFrom(int child_id, | 49 void GrantDeleteFrom(int child_id, const base::FilePath& dir) override; |
50 const base::FilePath& dir) override; | 50 void GrantReadFileSystem(int child_id, |
51 virtual void GrantReadFileSystem( | 51 const std::string& filesystem_id) override; |
| 52 void GrantWriteFileSystem(int child_id, |
| 53 const std::string& filesystem_id) override; |
| 54 void GrantCreateFileForFileSystem(int child_id, |
| 55 const std::string& filesystem_id) override; |
| 56 void GrantCreateReadWriteFileSystem( |
52 int child_id, | 57 int child_id, |
53 const std::string& filesystem_id) override; | 58 const std::string& filesystem_id) override; |
54 virtual void GrantWriteFileSystem( | 59 void GrantCopyIntoFileSystem(int child_id, |
55 int child_id, | 60 const std::string& filesystem_id) override; |
56 const std::string& filesystem_id) override; | 61 void GrantDeleteFromFileSystem(int child_id, |
57 virtual void GrantCreateFileForFileSystem( | |
58 int child_id, | |
59 const std::string& filesystem_id) override; | |
60 virtual void GrantCreateReadWriteFileSystem( | |
61 int child_id, | |
62 const std::string& filesystem_id) override; | |
63 virtual void GrantCopyIntoFileSystem( | |
64 int child_id, | |
65 const std::string& filesystem_id) override; | |
66 virtual void GrantDeleteFromFileSystem( | |
67 int child_id, | |
68 const std::string& filesystem_id) override; | |
69 virtual void GrantScheme(int child_id, const std::string& scheme) override; | |
70 virtual bool CanReadFile(int child_id, const base::FilePath& file) override; | |
71 virtual bool CanCreateReadWriteFile(int child_id, | |
72 const base::FilePath& file) override; | |
73 virtual bool CanReadFileSystem(int child_id, | |
74 const std::string& filesystem_id) override; | 62 const std::string& filesystem_id) override; |
75 virtual bool CanReadWriteFileSystem( | 63 void GrantScheme(int child_id, const std::string& scheme) override; |
76 int child_id, | 64 bool CanReadFile(int child_id, const base::FilePath& file) override; |
77 const std::string& filesystem_id) override; | 65 bool CanCreateReadWriteFile(int child_id, |
78 virtual bool CanCopyIntoFileSystem(int child_id, | 66 const base::FilePath& file) override; |
79 const std::string& filesystem_id) override; | 67 bool CanReadFileSystem(int child_id, |
80 virtual bool CanDeleteFromFileSystem( | 68 const std::string& filesystem_id) override; |
81 int child_id, | 69 bool CanReadWriteFileSystem(int child_id, |
82 const std::string& filesystem_id) override; | 70 const std::string& filesystem_id) override; |
83 virtual bool HasWebUIBindings(int child_id) override; | 71 bool CanCopyIntoFileSystem(int child_id, |
| 72 const std::string& filesystem_id) override; |
| 73 bool CanDeleteFromFileSystem(int child_id, |
| 74 const std::string& filesystem_id) override; |
| 75 bool HasWebUIBindings(int child_id) override; |
84 | 76 |
85 // Pseudo schemes are treated differently than other schemes because they | 77 // Pseudo schemes are treated differently than other schemes because they |
86 // cannot be requested like normal URLs. There is no mechanism for revoking | 78 // cannot be requested like normal URLs. There is no mechanism for revoking |
87 // pseudo schemes. | 79 // pseudo schemes. |
88 void RegisterPseudoScheme(const std::string& scheme); | 80 void RegisterPseudoScheme(const std::string& scheme); |
89 | 81 |
90 // Returns true iff |scheme| has been registered as pseudo scheme. | 82 // Returns true iff |scheme| has been registered as pseudo scheme. |
91 bool IsPseudoScheme(const std::string& scheme); | 83 bool IsPseudoScheme(const std::string& scheme); |
92 | 84 |
93 // Upon creation, child processes should register themselves by calling this | 85 // Upon creation, child processes should register themselves by calling this |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 WorkerToMainProcessMap worker_map_; | 261 WorkerToMainProcessMap worker_map_; |
270 | 262 |
271 FileSystemPermissionPolicyMap file_system_policy_map_; | 263 FileSystemPermissionPolicyMap file_system_policy_map_; |
272 | 264 |
273 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); | 265 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); |
274 }; | 266 }; |
275 | 267 |
276 } // namespace content | 268 } // namespace content |
277 | 269 |
278 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 270 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
OLD | NEW |