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

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

Issue 2633663003: Implements strict secure cookies as the default behavior in //net (Closed)
Patch Set: Rebase on ToT Created 3 years, 10 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_store_ios.h ('k') | ios/net/cookies/cookie_store_ios_unittest.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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 const std::string& name, 381 const std::string& name,
382 const std::string& value, 382 const std::string& value,
383 const std::string& domain, 383 const std::string& domain,
384 const std::string& path, 384 const std::string& path,
385 base::Time creation_time, 385 base::Time creation_time,
386 base::Time expiration_time, 386 base::Time expiration_time,
387 base::Time last_access_time, 387 base::Time last_access_time,
388 bool secure, 388 bool secure,
389 bool http_only, 389 bool http_only,
390 CookieSameSite same_site, 390 CookieSameSite same_site,
391 bool enforce_strict_secure,
392 CookiePriority priority, 391 CookiePriority priority,
393 const SetCookiesCallback& callback) { 392 const SetCookiesCallback& callback) {
394 DCHECK(thread_checker_.CalledOnValidThread()); 393 DCHECK(thread_checker_.CalledOnValidThread());
395 394
396 switch (synchronization_state_) { 395 switch (synchronization_state_) {
397 case NOT_SYNCHRONIZED: 396 case NOT_SYNCHRONIZED:
398 cookie_monster_->SetCookieWithDetailsAsync( 397 cookie_monster_->SetCookieWithDetailsAsync(
399 url, name, value, domain, path, creation_time, expiration_time, 398 url, name, value, domain, path, creation_time, expiration_time,
400 last_access_time, secure, http_only, same_site, enforce_strict_secure, 399 last_access_time, secure, http_only, same_site, priority,
401 priority, WrapSetCallback(callback)); 400 WrapSetCallback(callback));
402 break; 401 break;
403 case SYNCHRONIZED: 402 case SYNCHRONIZED:
404 // If cookies are not allowed, they are stashed in the CookieMonster, and 403 // If cookies are not allowed, they are stashed in the CookieMonster, and
405 // should be written there instead. 404 // should be written there instead.
406 DCHECK(SystemCookiesAllowed()); 405 DCHECK(SystemCookiesAllowed());
407 406
408 bool success = false; 407 bool success = false;
409 408
410 if (creation_time.is_null()) 409 if (creation_time.is_null())
411 creation_time = base::Time::Now(); 410 creation_time = base::Time::Now();
412 411
413 // First create a CanonicalCookie, to normalize the arguments, 412 // First create a CanonicalCookie, to normalize the arguments,
414 // particularly domain and path, and perform validation. 413 // particularly domain and path, and perform validation.
415 std::unique_ptr<net::CanonicalCookie> canonical_cookie = 414 std::unique_ptr<net::CanonicalCookie> canonical_cookie =
416 net::CanonicalCookie::Create( 415 net::CanonicalCookie::Create(
417 url, name, value, domain, path, creation_time, expiration_time, 416 url, name, value, domain, path, creation_time, expiration_time,
418 secure, http_only, same_site, enforce_strict_secure, priority); 417 secure, http_only, same_site, priority);
419 418
420 if (canonical_cookie) { 419 if (canonical_cookie) {
421 NSHTTPCookie* cookie = 420 NSHTTPCookie* cookie =
422 SystemCookieFromCanonicalCookie(*canonical_cookie); 421 SystemCookieFromCanonicalCookie(*canonical_cookie);
423 422
424 if (cookie != nil) { 423 if (cookie != nil) {
425 [system_store_ setCookie:cookie]; 424 [system_store_ setCookie:cookie];
426 creation_time_manager_->SetCreationTime( 425 creation_time_manager_->SetCreationTime(
427 cookie, creation_time_manager_->MakeUniqueCreationTime( 426 cookie, creation_time_manager_->MakeUniqueCreationTime(
428 canonical_cookie->CreationDate())); 427 canonical_cookie->CreationDate()));
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 weak_factory_.GetWeakPtr(), callback); 928 weak_factory_.GetWeakPtr(), callback);
930 } 929 }
931 930
932 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { 931 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) {
933 DCHECK(thread_checker_.CalledOnValidThread()); 932 DCHECK(thread_checker_.CalledOnValidThread());
934 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, 933 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure,
935 weak_factory_.GetWeakPtr(), callback); 934 weak_factory_.GetWeakPtr(), callback);
936 } 935 }
937 936
938 } // namespace net 937 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_store_ios.h ('k') | ios/net/cookies/cookie_store_ios_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698