| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
| 11 #include "chrome/common/bindings_policy.h" | 11 #include "chrome/common/bindings_policy.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (state == security_state_.end()) | 285 if (state == security_state_.end()) |
| 286 return false; | 286 return false; |
| 287 | 287 |
| 288 // Otherwise, we consult the renderer's security state to see if it is | 288 // Otherwise, we consult the renderer's security state to see if it is |
| 289 // allowed to request the URL. | 289 // allowed to request the URL. |
| 290 return state->second->CanRequestURL(url); | 290 return state->second->CanRequestURL(url); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool ChildProcessSecurityPolicy::CanUploadFile(int renderer_id, | 294 bool ChildProcessSecurityPolicy::CanUploadFile(int renderer_id, |
| 295 const FilePath& file) { | 295 const FilePath& file) { |
| 296 AutoLock lock(lock_); | 296 AutoLock lock(lock_); |
| 297 | 297 |
| 298 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 298 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 299 if (state == security_state_.end()) | 299 if (state == security_state_.end()) |
| 300 return false; | 300 return false; |
| 301 | 301 |
| 302 return state->second->CanUploadFile(file); | 302 return state->second->CanUploadFile(file); |
| 303 } | 303 } |
| 304 | 304 |
| 305 bool ChildProcessSecurityPolicy::HasDOMUIBindings(int renderer_id) { | 305 bool ChildProcessSecurityPolicy::HasDOMUIBindings(int renderer_id) { |
| 306 AutoLock lock(lock_); | 306 AutoLock lock(lock_); |
| 307 | 307 |
| 308 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 308 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 309 if (state == security_state_.end()) | 309 if (state == security_state_.end()) |
| 310 return false; | 310 return false; |
| 311 | 311 |
| 312 return state->second->has_dom_ui_bindings(); | 312 return state->second->has_dom_ui_bindings(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 bool ChildProcessSecurityPolicy::HasExtensionBindings(int renderer_id) { | 315 bool ChildProcessSecurityPolicy::HasExtensionBindings(int renderer_id) { |
| 316 AutoLock lock(lock_); | 316 AutoLock lock(lock_); |
| 317 | 317 |
| 318 SecurityStateMap::iterator state = security_state_.find(renderer_id); | 318 SecurityStateMap::iterator state = security_state_.find(renderer_id); |
| 319 if (state == security_state_.end()) | 319 if (state == security_state_.end()) |
| 320 return false; | 320 return false; |
| 321 | 321 |
| 322 return state->second->has_extension_bindings(); | 322 return state->second->has_extension_bindings(); |
| 323 } | 323 } |
| OLD | NEW |