| 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/child_process_security_policy.h" | 5 #include "chrome/browser/child_process_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/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 if (state == security_state_.end()) | 282 if (state == security_state_.end()) |
| 283 return false; | 283 return false; |
| 284 | 284 |
| 285 // Otherwise, we consult the renderer's security state to see if it is | 285 // Otherwise, we consult the renderer's security state to see if it is |
| 286 // allowed to request the URL. | 286 // allowed to request the URL. |
| 287 return state->second->CanRequestURL(url); | 287 return state->second->CanRequestURL(url); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool ChildProcessSecurityPolicy::CanUploadFile(int renderer_id, | 291 bool ChildProcessSecurityPolicy::CanUploadFile(int renderer_id, |
| 292 const FilePath& file) { | 292 const FilePath& file) { |
| 293 AutoLock lock(lock_); | 293 AutoLock lock(lock_); |
| 294 | 294 |
| 295 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 295 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 296 if (state == security_state_.end()) | 296 if (state == security_state_.end()) |
| 297 return false; | 297 return false; |
| 298 | 298 |
| 299 return state->second->CanUploadFile(file); | 299 return state->second->CanUploadFile(file); |
| 300 } | 300 } |
| 301 | 301 |
| 302 bool ChildProcessSecurityPolicy::HasDOMUIBindings(int renderer_id) { | 302 bool ChildProcessSecurityPolicy::HasDOMUIBindings(int renderer_id) { |
| 303 AutoLock lock(lock_); | 303 AutoLock lock(lock_); |
| 304 | 304 |
| 305 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 305 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 306 if (state == security_state_.end()) | 306 if (state == security_state_.end()) |
| 307 return false; | 307 return false; |
| 308 | 308 |
| 309 return state->second->has_dom_ui_bindings(); | 309 return state->second->has_dom_ui_bindings(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 bool ChildProcessSecurityPolicy::HasExtensionBindings(int renderer_id) { | 312 bool ChildProcessSecurityPolicy::HasExtensionBindings(int renderer_id) { |
| 313 AutoLock lock(lock_); | 313 AutoLock lock(lock_); |
| 314 | 314 |
| 315 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 315 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 316 if (state == security_state_.end()) | 316 if (state == security_state_.end()) |
| 317 return false; | 317 return false; |
| 318 | 318 |
| 319 return state->second->has_extension_bindings(); | 319 return state->second->has_extension_bindings(); |
| 320 } | 320 } |
| OLD | NEW |