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

Side by Side Diff: ios/net/cookies/cookie_store_ios.mm

Issue 2874843002: Shifted creation of unvalidated CanonicalCookies over to a constructor. (Closed)
Patch Set: Merged to top of dependent CL. Created 3 years, 7 months 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
« no previous file with comments | « ios/net/cookies/cookie_cache_unittest.cc ('k') | ios/net/cookies/cookie_store_ios_test_util.mm » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ios/net/cookies/cookie_store_ios.h" 5 #include "ios/net/cookies/cookie_store_ios.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 url::RawCanonOutputT<char> canon_path; 400 url::RawCanonOutputT<char> canon_path;
401 url::Component canon_path_component; 401 url::Component canon_path_component;
402 url::CanonicalizePath(cookie_path.data(), path_component, &canon_path, 402 url::CanonicalizePath(cookie_path.data(), path_component, &canon_path,
403 &canon_path_component); 403 &canon_path_component);
404 cookie_path = std::string(canon_path.data() + canon_path_component.begin, 404 cookie_path = std::string(canon_path.data() + canon_path_component.begin,
405 canon_path_component.len); 405 canon_path_component.len);
406 406
407 // First create a CanonicalCookie, to normalize the arguments, 407 // First create a CanonicalCookie, to normalize the arguments,
408 // particularly domain and path, and perform validation. 408 // particularly domain and path, and perform validation.
409 std::unique_ptr<net::CanonicalCookie> canonical_cookie = 409 std::unique_ptr<net::CanonicalCookie> canonical_cookie =
410 net::CanonicalCookie::Create(name, value, cookie_domain, cookie_path, 410 base::MakeUnique<net::CanonicalCookie>(
411 creation_time, expiration_time, 411 name, value, cookie_domain, cookie_path, creation_time,
412 creation_time, secure, http_only, same_site, 412 expiration_time, creation_time, secure, http_only, same_site,
413 priority); 413 priority);
414 414
415 if (canonical_cookie) { 415 if (canonical_cookie) {
416 NSHTTPCookie* cookie = SystemCookieFromCanonicalCookie(*canonical_cookie); 416 NSHTTPCookie* cookie = SystemCookieFromCanonicalCookie(*canonical_cookie);
417 417
418 if (cookie != nil) { 418 if (cookie != nil) {
419 [system_store_ setCookie:cookie]; 419 [system_store_ setCookie:cookie];
420 creation_time_manager_->SetCreationTime( 420 creation_time_manager_->SetCreationTime(
421 cookie, creation_time_manager_->MakeUniqueCreationTime( 421 cookie, creation_time_manager_->MakeUniqueCreationTime(
422 canonical_cookie->CreationDate())); 422 canonical_cookie->CreationDate()));
423 success = true; 423 success = true;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 net::CookieList cookie_list; 847 net::CookieList cookie_list;
848 cookie_list.reserve([cookies count]); 848 cookie_list.reserve([cookies count]);
849 for (NSHTTPCookie* cookie in cookies) { 849 for (NSHTTPCookie* cookie in cookies) {
850 base::Time created = creation_time_manager_->GetCreationTime(cookie); 850 base::Time created = creation_time_manager_->GetCreationTime(cookie);
851 cookie_list.push_back(CanonicalCookieFromSystemCookie(cookie, created)); 851 cookie_list.push_back(CanonicalCookieFromSystemCookie(cookie, created));
852 } 852 }
853 return cookie_list; 853 return cookie_list;
854 } 854 }
855 855
856 } // namespace net 856 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_cache_unittest.cc ('k') | ios/net/cookies/cookie_store_ios_test_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698