| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 5 #ifndef CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
| 6 #define CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 6 #define CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void GrantUploadFile(int renderer_id, const FilePath& file); | 71 void GrantUploadFile(int renderer_id, const FilePath& file); |
| 72 | 72 |
| 73 // Whenever the browser processes commands the renderer to run web inspector, | 73 // Whenever the browser processes commands the renderer to run web inspector, |
| 74 // it should call this method to grant the renderer process the capability to | 74 // it should call this method to grant the renderer process the capability to |
| 75 // run the inspector. | 75 // run the inspector. |
| 76 void GrantInspectElement(int renderer_id); | 76 void GrantInspectElement(int renderer_id); |
| 77 | 77 |
| 78 // Grant this renderer the ability to use DOM UI Bindings. | 78 // Grant this renderer the ability to use DOM UI Bindings. |
| 79 void GrantDOMUIBindings(int renderer_id); | 79 void GrantDOMUIBindings(int renderer_id); |
| 80 | 80 |
| 81 // Grant this renderer the ability to use extension Bindings. |
| 82 void GrantExtensionBindings(int renderer_id); |
| 83 |
| 81 // Before servicing a renderer's request for a URL, the browser should call | 84 // Before servicing a renderer's request for a URL, the browser should call |
| 82 // this method to determine whether the renderer has the capability to | 85 // this method to determine whether the renderer has the capability to |
| 83 // request the URL. | 86 // request the URL. |
| 84 bool CanRequestURL(int renderer_id, const GURL& url); | 87 bool CanRequestURL(int renderer_id, const GURL& url); |
| 85 | 88 |
| 86 // Before servicing a renderer's request to upload a file to the web, the | 89 // Before servicing a renderer's request to upload a file to the web, the |
| 87 // browser should call this method to determine whether the renderer has the | 90 // browser should call this method to determine whether the renderer has the |
| 88 // capability to upload the requested file. | 91 // capability to upload the requested file. |
| 89 bool CanUploadFile(int renderer_id, const FilePath& file); | 92 bool CanUploadFile(int renderer_id, const FilePath& file); |
| 90 | 93 |
| 91 // Returns true of the specified renderer_id has been granted DOMUIBindings. | 94 // Returns true of the specified renderer_id has been granted DOMUIBindings. |
| 92 // The browser should check this property before assuming the renderer is | 95 // The browser should check this property before assuming the renderer is |
| 93 // allowed to use DOMUIBindings. | 96 // allowed to use DOMUIBindings. |
| 94 bool HasDOMUIBindings(int renderer_id); | 97 bool HasDOMUIBindings(int renderer_id); |
| 95 | 98 |
| 99 // Returns true of the specified renderer_id has been granted DOMUIBindings. |
| 100 // The browser should check this property before assuming the renderer is |
| 101 // allowed to use extension bindings. |
| 102 bool HasExtensionBindings(int renderer_id); |
| 103 |
| 96 private: | 104 private: |
| 97 friend class ChildProcessSecurityPolicyInProcessBrowserTest; | 105 friend class ChildProcessSecurityPolicyInProcessBrowserTest; |
| 98 FRIEND_TEST(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak); | 106 FRIEND_TEST(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak); |
| 99 | 107 |
| 100 class SecurityState; | 108 class SecurityState; |
| 101 | 109 |
| 102 typedef std::set<std::string> SchemeSet; | 110 typedef std::set<std::string> SchemeSet; |
| 103 typedef std::map<int, SecurityState*> SecurityStateMap; | 111 typedef std::map<int, SecurityState*> SecurityStateMap; |
| 104 | 112 |
| 105 // Obtain an instance of ChildProcessSecurityPolicy via GetInstance(). | 113 // Obtain an instance of ChildProcessSecurityPolicy via GetInstance(). |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 // This map holds a SecurityState for each renderer process. The key for the | 130 // This map holds a SecurityState for each renderer process. The key for the |
| 123 // map is the ID of the RenderProcessHost. The SecurityState objects are | 131 // map is the ID of the RenderProcessHost. The SecurityState objects are |
| 124 // owned by this object and are protected by |lock_|. References to them must | 132 // owned by this object and are protected by |lock_|. References to them must |
| 125 // not escape this class. | 133 // not escape this class. |
| 126 SecurityStateMap security_state_; | 134 SecurityStateMap security_state_; |
| 127 | 135 |
| 128 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicy); | 136 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicy); |
| 129 }; | 137 }; |
| 130 | 138 |
| 131 #endif // CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 139 #endif // CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
| OLD | NEW |