OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |