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

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

Issue 1773133002: SameSite: Implement 'Strict'/'Lax' attribute parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke@ Created 4 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/system_cookie_util.h" 5 #include "ios/net/cookies/system_cookie_util.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/logging.h" 10 #include "base/logging.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Converts NSHTTPCookie to net::CanonicalCookie. 65 // Converts NSHTTPCookie to net::CanonicalCookie.
66 net::CanonicalCookie CanonicalCookieFromSystemCookie( 66 net::CanonicalCookie CanonicalCookieFromSystemCookie(
67 NSHTTPCookie* cookie, 67 NSHTTPCookie* cookie,
68 const base::Time& ceation_time) { 68 const base::Time& ceation_time) {
69 return net::CanonicalCookie( 69 return net::CanonicalCookie(
70 GURL(), base::SysNSStringToUTF8([cookie name]), 70 GURL(), base::SysNSStringToUTF8([cookie name]),
71 base::SysNSStringToUTF8([cookie value]), 71 base::SysNSStringToUTF8([cookie value]),
72 base::SysNSStringToUTF8([cookie domain]), 72 base::SysNSStringToUTF8([cookie domain]),
73 base::SysNSStringToUTF8([cookie path]), ceation_time, 73 base::SysNSStringToUTF8([cookie path]), ceation_time,
74 base::Time::FromDoubleT([[cookie expiresDate] timeIntervalSince1970]), 74 base::Time::FromDoubleT([[cookie expiresDate] timeIntervalSince1970]),
75 base::Time(), [cookie isSecure], [cookie isHTTPOnly], false, 75 base::Time(), [cookie isSecure], [cookie isHTTPOnly],
76 net::COOKIE_PRIORITY_DEFAULT); 76 // TODO(mkwst): When iOS begins to support 'SameSite' and 'Priority'
77 // attributes, pass them through here.
78 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT);
77 } 79 }
78 80
79 // Converts net::CanonicalCookie to NSHTTPCookie. 81 // Converts net::CanonicalCookie to NSHTTPCookie.
80 NSHTTPCookie* SystemCookieFromCanonicalCookie( 82 NSHTTPCookie* SystemCookieFromCanonicalCookie(
81 const net::CanonicalCookie& cookie) { 83 const net::CanonicalCookie& cookie) {
82 NSString* cookie_domain = base::SysUTF8ToNSString(cookie.Domain()); 84 NSString* cookie_domain = base::SysUTF8ToNSString(cookie.Domain());
83 NSString* cookie_name = base::SysUTF8ToNSString(cookie.Name()); 85 NSString* cookie_name = base::SysUTF8ToNSString(cookie.Name());
84 NSString* cookie_path = base::SysUTF8ToNSString(cookie.Path()); 86 NSString* cookie_path = base::SysUTF8ToNSString(cookie.Path());
85 NSString* cookie_value = base::SysUTF8ToNSString(cookie.Value()); 87 NSString* cookie_value = base::SysUTF8ToNSString(cookie.Value());
86 if (!cookie_domain || !cookie_name || !cookie_path || !cookie_value) { 88 if (!cookie_domain || !cookie_name || !cookie_path || !cookie_value) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ResetCookieCountMetrics(); 147 ResetCookieCountMetrics();
146 } 148 }
147 149
148 void ResetCookieCountMetrics() { 150 void ResetCookieCountMetrics() {
149 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 151 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
150 [defaults setBool:NO forKey:kCheckCookieLossKey]; 152 [defaults setBool:NO forKey:kCheckCookieLossKey];
151 [defaults synchronize]; 153 [defaults synchronize];
152 } 154 }
153 155
154 } // namespace net 156 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_store_ios_unittest.mm ('k') | ios/net/cookies/system_cookie_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698