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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_cookie_helper.cc

Issue 11341011: Make the BrowsingDataCookieHelper create canonical cookies with the correct cookie-domain attribute. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 net::ParsedCookie parsed_cookie(cookie_line); 136 net::ParsedCookie parsed_cookie(cookie_line);
137 if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) { 137 if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) {
138 // Return if a Javascript cookie illegally specified the HTTP only flag. 138 // Return if a Javascript cookie illegally specified the HTTP only flag.
139 return; 139 return;
140 } 140 }
141 141
142 // This fails to create a canonical cookie, if the normalized cookie domain 142 // This fails to create a canonical cookie, if the normalized cookie domain
143 // form cookie line and the url don't have the same domain+registry, or url 143 // form cookie line and the url don't have the same domain+registry, or url
144 // host isn't cookie domain or one of its subdomains. 144 // host isn't cookie domain or one of its subdomains.
145 scoped_ptr<net::CanonicalCookie> cookie( 145 scoped_ptr<net::CanonicalCookie> cookie(
146 net::CanonicalCookie::Create(url, parsed_cookie)); 146 new net::CanonicalCookie(url, parsed_cookie));
147 if (cookie.get()) 147 if (cookie.get())
148 AddCookie(frame_url, *cookie); 148 AddCookie(frame_url, *cookie);
149 } 149 }
150 150
151 void CannedBrowsingDataCookieHelper::Reset() { 151 void CannedBrowsingDataCookieHelper::Reset() {
152 STLDeleteContainerPairSecondPointers(origin_cookie_list_map_.begin(), 152 STLDeleteContainerPairSecondPointers(origin_cookie_list_map_.begin(),
153 origin_cookie_list_map_.end()); 153 origin_cookie_list_map_.end());
154 origin_cookie_list_map_.clear(); 154 origin_cookie_list_map_.clear();
155 } 155 }
156 156
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 void CannedBrowsingDataCookieHelper::AddCookie( 223 void CannedBrowsingDataCookieHelper::AddCookie(
224 const GURL& frame_url, 224 const GURL& frame_url,
225 const net::CanonicalCookie& cookie) { 225 const net::CanonicalCookie& cookie) {
226 net::CookieList* cookie_list = 226 net::CookieList* cookie_list =
227 GetCookiesFor(frame_url.GetOrigin()); 227 GetCookiesFor(frame_url.GetOrigin());
228 DeleteMatchingCookie(cookie, cookie_list); 228 DeleteMatchingCookie(cookie, cookie_list);
229 cookie_list->push_back(cookie); 229 cookie_list->push_back(cookie);
230 } 230 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698