| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // it should call this method to grant the renderer process the capability to | 73 // it should call this method to grant the renderer process the capability to |
| 74 // run the inspector. | 74 // run the inspector. |
| 75 void GrantInspectElement(int renderer_id); | 75 void GrantInspectElement(int renderer_id); |
| 76 | 76 |
| 77 // Grant this renderer the ability to use DOM UI Bindings. | 77 // Grant this renderer the ability to use DOM UI Bindings. |
| 78 void GrantDOMUIBindings(int renderer_id); | 78 void GrantDOMUIBindings(int renderer_id); |
| 79 | 79 |
| 80 // Grant this renderer the ability to use extension Bindings. | 80 // Grant this renderer the ability to use extension Bindings. |
| 81 void GrantExtensionBindings(int renderer_id); | 81 void GrantExtensionBindings(int renderer_id); |
| 82 | 82 |
| 83 // Grant this renderer the ability to read raw cookies. |
| 84 void GrantReadRawCookies(int renderer_id); |
| 85 |
| 86 // Revoke read raw cookies permission. |
| 87 void RevokeReadRawCookies(int renderer_id); |
| 88 |
| 83 // Before servicing a renderer's request for a URL, the browser should call | 89 // Before servicing a renderer's request for a URL, the browser should call |
| 84 // this method to determine whether the renderer has the capability to | 90 // this method to determine whether the renderer has the capability to |
| 85 // request the URL. | 91 // request the URL. |
| 86 bool CanRequestURL(int renderer_id, const GURL& url); | 92 bool CanRequestURL(int renderer_id, const GURL& url); |
| 87 | 93 |
| 88 // Before servicing a renderer's request to upload a file to the web, the | 94 // Before servicing a renderer's request to upload a file to the web, the |
| 89 // browser should call this method to determine whether the renderer has the | 95 // browser should call this method to determine whether the renderer has the |
| 90 // capability to upload the requested file. | 96 // capability to upload the requested file. |
| 91 bool CanUploadFile(int renderer_id, const FilePath& file); | 97 bool CanUploadFile(int renderer_id, const FilePath& file); |
| 92 | 98 |
| 93 // Returns true of the specified renderer_id has been granted DOMUIBindings. | 99 // Returns true if the specified renderer_id has been granted DOMUIBindings. |
| 94 // The browser should check this property before assuming the renderer is | 100 // The browser should check this property before assuming the renderer is |
| 95 // allowed to use DOMUIBindings. | 101 // allowed to use DOMUIBindings. |
| 96 bool HasDOMUIBindings(int renderer_id); | 102 bool HasDOMUIBindings(int renderer_id); |
| 97 | 103 |
| 98 // Returns true of the specified renderer_id has been granted DOMUIBindings. | 104 // Returns true if the specified renderer_id has been granted DOMUIBindings. |
| 99 // The browser should check this property before assuming the renderer is | 105 // The browser should check this property before assuming the renderer is |
| 100 // allowed to use extension bindings. | 106 // allowed to use extension bindings. |
| 101 bool HasExtensionBindings(int renderer_id); | 107 bool HasExtensionBindings(int renderer_id); |
| 102 | 108 |
| 109 // Returns true if the specified renderer_id has been granted ReadRawCookies. |
| 110 bool CanReadRawCookies(int renderer_id); |
| 111 |
| 103 private: | 112 private: |
| 104 friend class ChildProcessSecurityPolicyInProcessBrowserTest; | 113 friend class ChildProcessSecurityPolicyInProcessBrowserTest; |
| 105 FRIEND_TEST(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak); | 114 FRIEND_TEST(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak); |
| 106 | 115 |
| 107 class SecurityState; | 116 class SecurityState; |
| 108 | 117 |
| 109 typedef std::set<std::string> SchemeSet; | 118 typedef std::set<std::string> SchemeSet; |
| 110 typedef std::map<int, SecurityState*> SecurityStateMap; | 119 typedef std::map<int, SecurityState*> SecurityStateMap; |
| 111 | 120 |
| 112 // Obtain an instance of ChildProcessSecurityPolicy via GetInstance(). | 121 // Obtain an instance of ChildProcessSecurityPolicy via GetInstance(). |
| (...skipping 16 matching lines...) Expand all Loading... |
| 129 // This map holds a SecurityState for each renderer process. The key for the | 138 // This map holds a SecurityState for each renderer process. The key for the |
| 130 // map is the ID of the RenderProcessHost. The SecurityState objects are | 139 // map is the ID of the RenderProcessHost. The SecurityState objects are |
| 131 // owned by this object and are protected by |lock_|. References to them must | 140 // owned by this object and are protected by |lock_|. References to them must |
| 132 // not escape this class. | 141 // not escape this class. |
| 133 SecurityStateMap security_state_; | 142 SecurityStateMap security_state_; |
| 134 | 143 |
| 135 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicy); | 144 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicy); |
| 136 }; | 145 }; |
| 137 | 146 |
| 138 #endif // CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ | 147 #endif // CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_ |
| OLD | NEW |