| 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 #include "chrome/browser/renderer_host/renderer_security_policy.h" | 5 #include "chrome/browser/renderer_host/renderer_security_policy.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 state->second->GrantUploadFile(file); | 189 state->second->GrantUploadFile(file); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void RendererSecurityPolicy::GrantInspectElement(int renderer_id) { | 192 void RendererSecurityPolicy::GrantInspectElement(int renderer_id) { |
| 193 AutoLock lock(lock_); | 193 AutoLock lock(lock_); |
| 194 | 194 |
| 195 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 195 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 196 if (state == security_state_.end()) | 196 if (state == security_state_.end()) |
| 197 return; | 197 return; |
| 198 | 198 |
| 199 // The inspector is served from a chrome-ui: URL. In order to run the | 199 // The inspector is served from a chrome: URL. In order to run the |
| 200 // inspector, the renderer needs to be able to load chrome-ui URLs. | 200 // inspector, the renderer needs to be able to load chrome: URLs. |
| 201 state->second->GrantScheme(chrome::kChromeUIScheme); | 201 state->second->GrantScheme(chrome::kChromeUIScheme); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void RendererSecurityPolicy::GrantDOMUIBindings(int renderer_id) { | 204 void RendererSecurityPolicy::GrantDOMUIBindings(int renderer_id) { |
| 205 AutoLock lock(lock_); | 205 AutoLock lock(lock_); |
| 206 | 206 |
| 207 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 207 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 208 if (state == security_state_.end()) | 208 if (state == security_state_.end()) |
| 209 return; | 209 return; |
| 210 | 210 |
| 211 state->second->GrantDOMUIBindings(); | 211 state->second->GrantDOMUIBindings(); |
| 212 | 212 |
| 213 // DOM UI bindings need the ability to request chrome-ui URLs. | 213 // DOM UI bindings need the ability to request chrome: URLs. |
| 214 state->second->GrantScheme(chrome::kChromeUIScheme); | 214 state->second->GrantScheme(chrome::kChromeUIScheme); |
| 215 | 215 |
| 216 // DOM UI pages can contain links to file:// URLs. | 216 // DOM UI pages can contain links to file:// URLs. |
| 217 state->second->GrantScheme(chrome::kFileScheme); | 217 state->second->GrantScheme(chrome::kFileScheme); |
| 218 } | 218 } |
| 219 | 219 |
| 220 bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) { | 220 bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) { |
| 221 if (!url.is_valid()) | 221 if (!url.is_valid()) |
| 222 return false; // Can't request invalid URLs. | 222 return false; // Can't request invalid URLs. |
| 223 | 223 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 bool RendererSecurityPolicy::HasDOMUIBindings(int renderer_id) { | 272 bool RendererSecurityPolicy::HasDOMUIBindings(int renderer_id) { |
| 273 AutoLock lock(lock_); | 273 AutoLock lock(lock_); |
| 274 | 274 |
| 275 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 275 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 276 if (state == security_state_.end()) | 276 if (state == security_state_.end()) |
| 277 return false; | 277 return false; |
| 278 | 278 |
| 279 return state->second->has_dom_ui_bindings(); | 279 return state->second->has_dom_ui_bindings(); |
| 280 } | 280 } |
| OLD | NEW |