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 24 matching lines...) Expand all Loading... |
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 // Returns true iff |scheme| has been registered as pseudo scheme. |
| 46 virtual bool IsPseudoScheme(const std::string& scheme) OVERRIDE; |
45 virtual void GrantReadFile(int child_id, const base::FilePath& file) OVERRIDE; | 47 virtual void GrantReadFile(int child_id, const base::FilePath& file) OVERRIDE; |
46 virtual void GrantCreateReadWriteFile(int child_id, | 48 virtual void GrantCreateReadWriteFile(int child_id, |
47 const base::FilePath& file) OVERRIDE; | 49 const base::FilePath& file) OVERRIDE; |
48 virtual void GrantCopyInto(int child_id, const base::FilePath& dir) OVERRIDE; | 50 virtual void GrantCopyInto(int child_id, const base::FilePath& dir) OVERRIDE; |
49 virtual void GrantDeleteFrom(int child_id, | 51 virtual void GrantDeleteFrom(int child_id, |
50 const base::FilePath& dir) OVERRIDE; | 52 const base::FilePath& dir) OVERRIDE; |
51 virtual void GrantReadFileSystem( | 53 virtual void GrantReadFileSystem( |
52 int child_id, | 54 int child_id, |
53 const std::string& filesystem_id) OVERRIDE; | 55 const std::string& filesystem_id) OVERRIDE; |
54 virtual void GrantWriteFileSystem( | 56 virtual void GrantWriteFileSystem( |
(...skipping 24 matching lines...) Expand all Loading... |
79 const std::string& filesystem_id) OVERRIDE; | 81 const std::string& filesystem_id) OVERRIDE; |
80 virtual bool CanDeleteFromFileSystem( | 82 virtual bool CanDeleteFromFileSystem( |
81 int child_id, | 83 int child_id, |
82 const std::string& filesystem_id) OVERRIDE; | 84 const std::string& filesystem_id) OVERRIDE; |
83 | 85 |
84 // Pseudo schemes are treated differently than other schemes because they | 86 // Pseudo schemes are treated differently than other schemes because they |
85 // cannot be requested like normal URLs. There is no mechanism for revoking | 87 // cannot be requested like normal URLs. There is no mechanism for revoking |
86 // pseudo schemes. | 88 // pseudo schemes. |
87 void RegisterPseudoScheme(const std::string& scheme); | 89 void RegisterPseudoScheme(const std::string& scheme); |
88 | 90 |
89 // Returns true iff |scheme| has been registered as pseudo scheme. | |
90 bool IsPseudoScheme(const std::string& scheme); | |
91 | |
92 // Upon creation, child processes should register themselves by calling this | 91 // Upon creation, child processes should register themselves by calling this |
93 // this method exactly once. | 92 // this method exactly once. |
94 void Add(int child_id); | 93 void Add(int child_id); |
95 | 94 |
96 // Upon creation, worker thread child processes should register themselves by | 95 // Upon creation, worker thread child processes should register themselves by |
97 // calling this this method exactly once. Workers that are not shared will | 96 // calling this this method exactly once. Workers that are not shared will |
98 // inherit permissions from their parent renderer process identified with | 97 // inherit permissions from their parent renderer process identified with |
99 // |main_render_process_id|. | 98 // |main_render_process_id|. |
100 void AddWorker(int worker_child_id, int main_render_process_id); | 99 void AddWorker(int worker_child_id, int main_render_process_id); |
101 | 100 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 WorkerToMainProcessMap worker_map_; | 274 WorkerToMainProcessMap worker_map_; |
276 | 275 |
277 FileSystemPermissionPolicyMap file_system_policy_map_; | 276 FileSystemPermissionPolicyMap file_system_policy_map_; |
278 | 277 |
279 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); | 278 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); |
280 }; | 279 }; |
281 | 280 |
282 } // namespace content | 281 } // namespace content |
283 | 282 |
284 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ | 283 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ |
OLD | NEW |