Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: chrome/browser/child_process_security_policy.cc

Issue 294025: DevTools: Implement raw cookies access for inspector. (Closed)
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+}

Powered by Google App Engine
This is Rietveld 408576698