diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-29 16:07:21 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-29 16:07:21 +0000 |
commit | 971713ef6b3cb00c871a3420b890c0feeb80d605 (patch) | |
tree | 0df6925f83f162737a2b7813a5e19e7a6b8f228a /net/base/cookie_monster.cc | |
parent | 2add77b802f0f5cab795a0a4d9ecb48003447d51 (diff) | |
download | chromium_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 'net/base/cookie_monster.cc')
-rw-r--r-- | net/base/cookie_monster.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index e20c03d..2c2f21d 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -769,6 +769,38 @@ std::string CookieMonster::GetCookiesWithOptions(const GURL& url, 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(); |