| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/child_process_security_policy.h" | 5 #include "content/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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "content/browser/site_instance_impl.h" |
| 13 #include "content/public/browser/content_browser_client.h" | 14 #include "content/public/browser/content_browser_client.h" |
| 14 #include "content/browser/site_instance.h" | |
| 15 #include "content/public/common/bindings_policy.h" | 15 #include "content/public/common/bindings_policy.h" |
| 16 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 19 | 19 |
| 20 using content::SiteInstance; |
| 21 |
| 20 static const int kReadFilePermissions = | 22 static const int kReadFilePermissions = |
| 21 base::PLATFORM_FILE_OPEN | | 23 base::PLATFORM_FILE_OPEN | |
| 22 base::PLATFORM_FILE_READ | | 24 base::PLATFORM_FILE_READ | |
| 23 base::PLATFORM_FILE_EXCLUSIVE_READ | | 25 base::PLATFORM_FILE_EXCLUSIVE_READ | |
| 24 base::PLATFORM_FILE_ASYNC; | 26 base::PLATFORM_FILE_ASYNC; |
| 25 | 27 |
| 26 static const int kEnumerateDirectoryPermissions = | 28 static const int kEnumerateDirectoryPermissions = |
| 27 kReadFilePermissions | | 29 kReadFilePermissions | |
| 28 base::PLATFORM_FILE_ENUMERATE; | 30 base::PLATFORM_FILE_ENUMERATE; |
| 29 | 31 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 480 |
| 479 void ChildProcessSecurityPolicy::LockToOrigin(int child_id, const GURL& gurl) { | 481 void ChildProcessSecurityPolicy::LockToOrigin(int child_id, const GURL& gurl) { |
| 480 // "gurl" can be currently empty in some cases, such as file://blah. | 482 // "gurl" can be currently empty in some cases, such as file://blah. |
| 481 DCHECK(SiteInstance::GetSiteForURL(NULL, gurl) == gurl); | 483 DCHECK(SiteInstance::GetSiteForURL(NULL, gurl) == gurl); |
| 482 base::AutoLock lock(lock_); | 484 base::AutoLock lock(lock_); |
| 483 SecurityStateMap::iterator state = security_state_.find(child_id); | 485 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 484 DCHECK(state != security_state_.end()); | 486 DCHECK(state != security_state_.end()); |
| 485 state->second->LockToOrigin(gurl); | 487 state->second->LockToOrigin(gurl); |
| 486 } | 488 } |
| 487 | 489 |
| OLD | NEW |