OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 break; | 59 break; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
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::Create( |
70 GURL(), base::SysNSStringToUTF8([cookie name]), | 70 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], | 75 base::Time(), [cookie isSecure], [cookie isHTTPOnly], |
76 // TODO(mkwst): When iOS begins to support 'SameSite' and 'Priority' | 76 // TODO(mkwst): When iOS begins to support 'SameSite' and 'Priority' |
77 // attributes, pass them through here. | 77 // attributes, pass them through here. |
78 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); | 78 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); |
79 } | 79 } |
80 | 80 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 ResetCookieCountMetrics(); | 147 ResetCookieCountMetrics(); |
148 } | 148 } |
149 | 149 |
150 void ResetCookieCountMetrics() { | 150 void ResetCookieCountMetrics() { |
151 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 151 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
152 [defaults setBool:NO forKey:kCheckCookieLossKey]; | 152 [defaults setBool:NO forKey:kCheckCookieLossKey]; |
153 [defaults synchronize]; | 153 [defaults synchronize]; |
154 } | 154 } |
155 | 155 |
156 } // namespace net | 156 } // namespace net |
OLD | NEW |