summaryrefslogtreecommitdiffstats
path: root/chrome/browser/child_process_security_policy.cc
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 16:07:21 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 16:07:21 +0000
commit971713ef6b3cb00c871a3420b890c0feeb80d605 (patch)
tree0df6925f83f162737a2b7813a5e19e7a6b8f228a /chrome/browser/child_process_security_policy.cc
parent2add77b802f0f5cab795a0a4d9ecb48003447d51 (diff)
downloadchromium_src-971713ef6b3cb00c871a3420b890c0feeb80d605.zip
chromium_src-971713ef6b3cb00c871a3420b890c0feeb80d605.tar.gz
chromium_src-971713ef6b3cb00c871a3420b890c0feeb80d605.tar.bz2
DevTools: Implement raw cookies access for inspector.
Review URL: http://codereview.chromium.org/294025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/child_process_security_policy.cc')
-rw-r--r--chrome/browser/child_process_security_policy.cc48
1 files changed, 47 insertions, 1 deletions
diff --git a/chrome/browser/child_process_security_policy.cc b/chrome/browser/child_process_security_policy.cc
index 7f009e9..635e0cf 100644
--- a/chrome/browser/child_process_security_policy.cc
+++ b/chrome/browser/child_process_security_policy.cc
@@ -17,7 +17,9 @@
// information.
class ChildProcessSecurityPolicy::SecurityState {
public:
- SecurityState() : enabled_bindings_(0) { }
+ SecurityState()
+ : enabled_bindings_(0),
+ can_read_raw_cookies_(false) { }
~SecurityState() {
scheme_policy_.clear();
}
@@ -41,6 +43,14 @@ class ChildProcessSecurityPolicy::SecurityState {
enabled_bindings_ |= bindings;
}
+ void GrantReadRawCookies() {
+ can_read_raw_cookies_ = true;
+ }
+
+ void RevokeReadRawCookies() {
+ can_read_raw_cookies_ = false;
+ }
+
// Determine whether permission has been granted to request url.
// Schemes that have not been granted default to being denied.
bool CanRequestURL(const GURL& url) {
@@ -66,6 +76,10 @@ class ChildProcessSecurityPolicy::SecurityState {
return BindingsPolicy::is_extension_enabled(enabled_bindings_);
}
+ bool can_read_raw_cookies() const {
+ return can_read_raw_cookies_;
+ }
+
private:
typedef std::map<std::string, bool> SchemeMap;
typedef std::set<FilePath> FileSet;
@@ -82,6 +96,8 @@ class ChildProcessSecurityPolicy::SecurityState {
int enabled_bindings_;
+ bool can_read_raw_cookies_;
+
DISALLOW_COPY_AND_ASSIGN(SecurityState);
};
@@ -252,6 +268,26 @@ void ChildProcessSecurityPolicy::GrantExtensionBindings(int renderer_id) {
state->second->GrantBindings(BindingsPolicy::EXTENSION);
}
+void ChildProcessSecurityPolicy::GrantReadRawCookies(int renderer_id) {
+ AutoLock lock(lock_);
+
+ SecurityStateMap::iterator state = security_state_.find(renderer_id);
+ if (state == security_state_.end())
+ return;
+
+ state->second->GrantReadRawCookies();
+}
+
+void ChildProcessSecurityPolicy::RevokeReadRawCookies(int renderer_id) {
+ AutoLock lock(lock_);
+
+ SecurityStateMap::iterator state = security_state_.find(renderer_id);
+ if (state == security_state_.end())
+ return;
+
+ state->second->RevokeReadRawCookies();
+}
+
bool ChildProcessSecurityPolicy::CanRequestURL(
int renderer_id, const GURL& url) {
if (!url.is_valid())
@@ -325,3 +361,13 @@ bool ChildProcessSecurityPolicy::HasExtensionBindings(int renderer_id) {
return state->second->has_extension_bindings();
}
+
+bool ChildProcessSecurityPolicy::CanReadRawCookies(int renderer_id) {
+ AutoLock lock(lock_);
+
+ SecurityStateMap::iterator state = security_state_.find(renderer_id);
+ if (state == security_state_.end())
+ return false;
+
+ return state->second->can_read_raw_cookies();
+}