summaryrefslogtreecommitdiffstats
path: root/chrome/browser/child_process_security_policy.cc
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /chrome/browser/child_process_security_policy.cc
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'chrome/browser/child_process_security_policy.cc')
-rw-r--r--chrome/browser/child_process_security_policy.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/chrome/browser/child_process_security_policy.cc b/chrome/browser/child_process_security_policy.cc
index 5068e57..67b8a7c 100644
--- a/chrome/browser/child_process_security_policy.cc
+++ b/chrome/browser/child_process_security_policy.cc
@@ -14,7 +14,7 @@
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request.h"
-const int kReadFilePermissions =
+static const int kReadFilePermissions =
base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_EXCLUSIVE_READ |
@@ -46,6 +46,11 @@ class ChildProcessSecurityPolicy::SecurityState {
file_permissions_[file.StripTrailingSeparators()] |= permissions;
}
+ // Revokes all permissions granted to a file.
+ void RevokeAllPermissionsForFile(const FilePath& file) {
+ file_permissions_.erase(file.StripTrailingSeparators());
+ }
+
void GrantBindings(int bindings) {
enabled_bindings_ |= bindings;
}
@@ -97,7 +102,7 @@ class ChildProcessSecurityPolicy::SecurityState {
private:
typedef std::map<std::string, bool> SchemeMap;
- typedef std::map<FilePath, int> FileMap; // bit-set of PlatformFileFlags
+ typedef std::map<FilePath, int> FileMap; // bit-set of PlatformFileFlags
// Maps URL schemes to whether permission has been granted or revoked:
// |true| means the scheme has been granted.
@@ -246,6 +251,17 @@ void ChildProcessSecurityPolicy::GrantPermissionsForFile(
state->second->GrantPermissionsForFile(file, permissions);
}
+void ChildProcessSecurityPolicy::RevokeAllPermissionsForFile(
+ int renderer_id, const FilePath& file) {
+ AutoLock lock(lock_);
+
+ SecurityStateMap::iterator state = security_state_.find(renderer_id);
+ if (state == security_state_.end())
+ return;
+
+ state->second->RevokeAllPermissionsForFile(file);
+}
+
void ChildProcessSecurityPolicy::GrantScheme(int renderer_id,
const std::string& scheme) {
AutoLock lock(lock_);