| 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 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 6 | 6 |
| 7 #include "utility" | 7 #include "utility" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 net::ParsedCookie parsed_cookie(cookie_line); | 140 net::ParsedCookie parsed_cookie(cookie_line); |
| 141 if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) { | 141 if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) { |
| 142 // Return if a Javascript cookie illegally specified the HTTP only flag. | 142 // Return if a Javascript cookie illegally specified the HTTP only flag. |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // This fails to create a canonical cookie, if the normalized cookie domain | 146 // This fails to create a canonical cookie, if the normalized cookie domain |
| 147 // form cookie line and the url don't have the same domain+registry, or url | 147 // form cookie line and the url don't have the same domain+registry, or url |
| 148 // host isn't cookie domain or one of its subdomains. | 148 // host isn't cookie domain or one of its subdomains. |
| 149 scoped_ptr<net::CanonicalCookie> cookie( | 149 scoped_ptr<net::CanonicalCookie> cookie( |
| 150 new net::CanonicalCookie(url, parsed_cookie)); | 150 net::CanonicalCookie::Create(url, parsed_cookie)); |
| 151 if (cookie.get()) | 151 if (cookie.get()) |
| 152 AddCookie(frame_url, *cookie); | 152 AddCookie(frame_url, *cookie); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void CannedBrowsingDataCookieHelper::Reset() { | 155 void CannedBrowsingDataCookieHelper::Reset() { |
| 156 STLDeleteContainerPairSecondPointers(origin_cookie_list_map_.begin(), | 156 STLDeleteContainerPairSecondPointers(origin_cookie_list_map_.begin(), |
| 157 origin_cookie_list_map_.end()); | 157 origin_cookie_list_map_.end()); |
| 158 origin_cookie_list_map_.clear(); | 158 origin_cookie_list_map_.clear(); |
| 159 } | 159 } |
| 160 | 160 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // collecting cookies per origin in redirect chains. | 240 // collecting cookies per origin in redirect chains. |
| 241 // TODO(markusheintz): A) Change the GetCookiesCount method to prevent | 241 // TODO(markusheintz): A) Change the GetCookiesCount method to prevent |
| 242 // counting cookies multiple times if they are stored in multiple cookie | 242 // counting cookies multiple times if they are stored in multiple cookie |
| 243 // lists. B) Replace the GetCookieFor method call below with: | 243 // lists. B) Replace the GetCookieFor method call below with: |
| 244 // "GetCookiesFor(frame_url.GetOrigin());" | 244 // "GetCookiesFor(frame_url.GetOrigin());" |
| 245 net::CookieList* cookie_list = | 245 net::CookieList* cookie_list = |
| 246 GetCookiesFor(GURL(kGlobalCookieListURL)); | 246 GetCookiesFor(GURL(kGlobalCookieListURL)); |
| 247 DeleteMatchingCookie(cookie, cookie_list); | 247 DeleteMatchingCookie(cookie, cookie_list); |
| 248 cookie_list->push_back(cookie); | 248 cookie_list->push_back(cookie); |
| 249 } | 249 } |
| OLD | NEW |