OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
9 * | 9 * |
10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 | 1344 |
1345 CookieList cookie_list; | 1345 CookieList cookie_list; |
1346 cookie_list.reserve(cookie_ptrs.size()); | 1346 cookie_list.reserve(cookie_ptrs.size()); |
1347 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); | 1347 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); |
1348 it != cookie_ptrs.end(); ++it) | 1348 it != cookie_ptrs.end(); ++it) |
1349 cookie_list.push_back(**it); | 1349 cookie_list.push_back(**it); |
1350 | 1350 |
1351 return cookie_list; | 1351 return cookie_list; |
1352 } | 1352 } |
1353 | 1353 |
1354 CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) { | 1354 CookieList CookieMonster::GetAllCookiesForURLWithOptions( |
| 1355 const GURL& url, |
| 1356 const CookieOptions& options) { |
1355 AutoLock autolock(lock_); | 1357 AutoLock autolock(lock_); |
1356 InitIfNecessary(); | 1358 InitIfNecessary(); |
1357 | 1359 |
1358 CookieOptions options; | |
1359 options.set_include_httponly(); | |
1360 | |
1361 std::vector<CanonicalCookie*> cookie_ptrs; | 1360 std::vector<CanonicalCookie*> cookie_ptrs; |
1362 FindCookiesForHostAndDomain(url, options, false, &cookie_ptrs); | 1361 FindCookiesForHostAndDomain(url, options, false, &cookie_ptrs); |
1363 std::sort(cookie_ptrs.begin(), cookie_ptrs.end(), CookieSorter); | 1362 std::sort(cookie_ptrs.begin(), cookie_ptrs.end(), CookieSorter); |
1364 | 1363 |
1365 CookieList cookies; | 1364 CookieList cookies; |
1366 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); | 1365 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); |
1367 it != cookie_ptrs.end(); it++) | 1366 it != cookie_ptrs.end(); it++) |
1368 cookies.push_back(**it); | 1367 cookies.push_back(**it); |
1369 | 1368 |
1370 return cookies; | 1369 return cookies; |
1371 } | 1370 } |
1372 | 1371 |
| 1372 CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) { |
| 1373 CookieOptions options; |
| 1374 options.set_include_httponly(); |
| 1375 |
| 1376 return GetAllCookiesForURLWithOptions(url, options); |
| 1377 } |
| 1378 |
1373 void CookieMonster::FindCookiesForHostAndDomain( | 1379 void CookieMonster::FindCookiesForHostAndDomain( |
1374 const GURL& url, | 1380 const GURL& url, |
1375 const CookieOptions& options, | 1381 const CookieOptions& options, |
1376 bool update_access_time, | 1382 bool update_access_time, |
1377 std::vector<CanonicalCookie*>* cookies) { | 1383 std::vector<CanonicalCookie*>* cookies) { |
1378 lock_.AssertAcquired(); | 1384 lock_.AssertAcquired(); |
1379 | 1385 |
1380 const Time current_time(CurrentTime()); | 1386 const Time current_time(CurrentTime()); |
1381 | 1387 |
1382 // Probe to save statistics relatively frequently. We do it here rather | 1388 // Probe to save statistics relatively frequently. We do it here rather |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 return base::StringPrintf( | 1997 return base::StringPrintf( |
1992 "name: %s value: %s domain: %s path: %s creation: %" | 1998 "name: %s value: %s domain: %s path: %s creation: %" |
1993 PRId64, | 1999 PRId64, |
1994 name_.c_str(), value_.c_str(), | 2000 name_.c_str(), value_.c_str(), |
1995 domain_.c_str(), path_.c_str(), | 2001 domain_.c_str(), path_.c_str(), |
1996 static_cast<int64>(creation_date_.ToTimeT())); | 2002 static_cast<int64>(creation_date_.ToTimeT())); |
1997 } | 2003 } |
1998 | 2004 |
1999 } // namespace | 2005 } // namespace |
2000 | 2006 |
OLD | NEW |