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

Unified Diff: net/base/cookie_monster.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: net/base/cookie_monster.cc
===================================================================
--- net/base/cookie_monster.cc (revision 30453)
+++ net/base/cookie_monster.cc (working copy)
@@ -769,6 +769,38 @@
return cookie_line;
}
+void CookieMonster::GetRawCookies(const GURL& url,
+ std::vector<CanonicalCookie>* raw_cookies) {
+ raw_cookies->clear();
+ if (!HasCookieableScheme(url))
+ return;
+
+ CookieOptions options;
+ options.set_include_httponly();
+ // Get the cookies for this host and its domain(s).
+ std::vector<CanonicalCookie*> cookies;
+ FindCookiesForHostAndDomain(url, options, &cookies);
+ std::sort(cookies.begin(), cookies.end(), CookieSorter);
+
+ for (std::vector<CanonicalCookie*>::const_iterator it = cookies.begin();
+ it != cookies.end(); ++it)
+ raw_cookies->push_back(*(*it));
+}
+
+void CookieMonster::DeleteCookie(const GURL& url,
+ const std::string& cookie_name) {
+ if (!HasCookieableScheme(url))
+ return;
+
+ for (CookieMapItPair its = cookies_.equal_range(url.host());
+ its.first != its.second; ++its.first) {
+ if (its.first->second->Name() == cookie_name) {
+ InternalDeleteCookie(its.first, true);
+ return;
+ }
+ }
+}
+
CookieMonster::CookieList CookieMonster::GetAllCookies() {
AutoLock autolock(lock_);
InitIfNecessary();

Powered by Google App Engine
This is Rietveld 408576698