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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 break; | 63 break; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 // Converts NSHTTPCookie to net::CanonicalCookie. | 69 // Converts NSHTTPCookie to net::CanonicalCookie. |
70 net::CanonicalCookie CanonicalCookieFromSystemCookie( | 70 net::CanonicalCookie CanonicalCookieFromSystemCookie( |
71 NSHTTPCookie* cookie, | 71 NSHTTPCookie* cookie, |
72 const base::Time& ceation_time) { | 72 const base::Time& ceation_time) { |
73 return *net::CanonicalCookie::Create( | 73 return net::CanonicalCookie( |
74 base::SysNSStringToUTF8([cookie name]), | 74 base::SysNSStringToUTF8([cookie name]), |
75 base::SysNSStringToUTF8([cookie value]), | 75 base::SysNSStringToUTF8([cookie value]), |
76 base::SysNSStringToUTF8([cookie domain]), | 76 base::SysNSStringToUTF8([cookie domain]), |
77 base::SysNSStringToUTF8([cookie path]), ceation_time, | 77 base::SysNSStringToUTF8([cookie path]), ceation_time, |
78 base::Time::FromDoubleT([[cookie expiresDate] timeIntervalSince1970]), | 78 base::Time::FromDoubleT([[cookie expiresDate] timeIntervalSince1970]), |
79 base::Time(), [cookie isSecure], [cookie isHTTPOnly], | 79 base::Time(), [cookie isSecure], [cookie isHTTPOnly], |
80 // TODO(mkwst): When iOS begins to support 'SameSite' and 'Priority' | 80 // TODO(mkwst): When iOS begins to support 'SameSite' and 'Priority' |
81 // attributes, pass them through here. | 81 // attributes, pass them through here. |
82 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); | 82 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); |
83 } | 83 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 ResetCookieCountMetrics(); | 151 ResetCookieCountMetrics(); |
152 } | 152 } |
153 | 153 |
154 void ResetCookieCountMetrics() { | 154 void ResetCookieCountMetrics() { |
155 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 155 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
156 [defaults setBool:NO forKey:kCheckCookieLossKey]; | 156 [defaults setBool:NO forKey:kCheckCookieLossKey]; |
157 [defaults synchronize]; | 157 [defaults synchronize]; |
158 } | 158 } |
159 | 159 |
160 } // namespace net | 160 } // namespace net |
OLD | NEW |