OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 CookieList CookieMonster::GetAllCookiesForURLWithOptions( | 1155 CookieList CookieMonster::GetAllCookiesForURLWithOptions( |
1156 const GURL& url, | 1156 const GURL& url, |
1157 const CookieOptions& options) { | 1157 const CookieOptions& options) { |
1158 base::AutoLock autolock(lock_); | 1158 base::AutoLock autolock(lock_); |
1159 | 1159 |
1160 std::vector<CanonicalCookie*> cookie_ptrs; | 1160 std::vector<CanonicalCookie*> cookie_ptrs; |
1161 FindCookiesForHostAndDomain(url, options, false, &cookie_ptrs); | 1161 FindCookiesForHostAndDomain(url, options, false, &cookie_ptrs); |
1162 std::sort(cookie_ptrs.begin(), cookie_ptrs.end(), CookieSorter); | 1162 std::sort(cookie_ptrs.begin(), cookie_ptrs.end(), CookieSorter); |
1163 | 1163 |
1164 CookieList cookies; | 1164 CookieList cookies; |
| 1165 cookies.reserve(cookie_ptrs.size()); |
1165 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); | 1166 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); |
1166 it != cookie_ptrs.end(); it++) | 1167 it != cookie_ptrs.end(); it++) |
1167 cookies.push_back(**it); | 1168 cookies.push_back(**it); |
1168 | 1169 |
1169 return cookies; | 1170 return cookies; |
1170 } | 1171 } |
1171 | 1172 |
1172 CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) { | 1173 CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) { |
1173 CookieOptions options; | 1174 CookieOptions options; |
1174 options.set_include_httponly(); | 1175 options.set_include_httponly(); |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 it != hook_map_.end(); ++it) { | 2334 it != hook_map_.end(); ++it) { |
2334 std::pair<GURL, std::string> key = it->first; | 2335 std::pair<GURL, std::string> key = it->first; |
2335 if (cookie.IncludeForRequestURL(key.first, opts) && | 2336 if (cookie.IncludeForRequestURL(key.first, opts) && |
2336 cookie.Name() == key.second) { | 2337 cookie.Name() == key.second) { |
2337 it->second->Notify(cookie, removed); | 2338 it->second->Notify(cookie, removed); |
2338 } | 2339 } |
2339 } | 2340 } |
2340 } | 2341 } |
2341 | 2342 |
2342 } // namespace net | 2343 } // namespace net |
OLD | NEW |