| Index: chrome/browser/child_process_security_policy.cc
|
| ===================================================================
|
| --- chrome/browser/child_process_security_policy.cc (revision 30453)
|
| +++ chrome/browser/child_process_security_policy.cc (working copy)
|
| @@ -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 @@
|
| 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 @@
|
| 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 @@
|
|
|
| int enabled_bindings_;
|
|
|
| + bool can_read_raw_cookies_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(SecurityState);
|
| };
|
|
|
| @@ -252,6 +268,26 @@
|
| 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 @@
|
|
|
| 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();
|
| +}
|
|
|