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 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void SetCookieWithDetailsAsync(const GURL& url, | 93 void SetCookieWithDetailsAsync(const GURL& url, |
94 const std::string& name, | 94 const std::string& name, |
95 const std::string& value, | 95 const std::string& value, |
96 const std::string& domain, | 96 const std::string& domain, |
97 const std::string& path, | 97 const std::string& path, |
98 base::Time creation_time, | 98 base::Time creation_time, |
99 base::Time expiration_time, | 99 base::Time expiration_time, |
100 base::Time last_access_time, | 100 base::Time last_access_time, |
101 bool secure, | 101 bool secure, |
102 bool http_only, | 102 bool http_only, |
103 bool same_site, | 103 CookieSameSite same_site, |
104 bool enforce_strict_secure, | 104 bool enforce_strict_secure, |
105 CookiePriority priority, | 105 CookiePriority priority, |
106 const SetCookiesCallback& callback) override { | 106 const SetCookiesCallback& callback) override { |
107 RoundTrip(); | 107 RoundTrip(); |
108 store_->SetCookieWithDetailsAsync( | 108 store_->SetCookieWithDetailsAsync( |
109 url, name, value, domain, path, creation_time, expiration_time, | 109 url, name, value, domain, path, creation_time, expiration_time, |
110 last_access_time, secure, http_only, same_site, enforce_strict_secure, | 110 last_access_time, secure, http_only, same_site, enforce_strict_secure, |
111 priority, callback); | 111 priority, callback); |
112 } | 112 } |
113 | 113 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Some canonical cookies cannot be converted into System cookies, for | 257 // Some canonical cookies cannot be converted into System cookies, for |
258 // example if value is not valid utf8. Such cookies are ignored. | 258 // example if value is not valid utf8. Such cookies are ignored. |
259 net::CanonicalCookie* bad_canonical_cookie = new net::CanonicalCookie( | 259 net::CanonicalCookie* bad_canonical_cookie = new net::CanonicalCookie( |
260 kTestCookieURL, "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", | 260 kTestCookieURL, "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", |
261 "path/", | 261 "path/", |
262 base::Time(), // creation | 262 base::Time(), // creation |
263 base::Time(), // expires | 263 base::Time(), // expires |
264 base::Time(), // last_access | 264 base::Time(), // last_access |
265 false, // secure | 265 false, // secure |
266 false, // httponly | 266 false, // httponly |
267 false, // same_site | 267 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); |
268 net::COOKIE_PRIORITY_DEFAULT); | |
269 cookies.push_back(bad_canonical_cookie); | 268 cookies.push_back(bad_canonical_cookie); |
270 loaded_callback_.Run(cookies); | 269 loaded_callback_.Run(cookies); |
271 } | 270 } |
272 | 271 |
273 bool flushed() { return flushed_; } | 272 bool flushed() { return flushed_; } |
274 | 273 |
275 private: | 274 private: |
276 // net::CookieMonster::PersistentCookieStore implementation: | 275 // net::CookieMonster::PersistentCookieStore implementation: |
277 void Load(const LoadedCallback& loaded_callback) override { | 276 void Load(const LoadedCallback& loaded_callback) override { |
278 loaded_callback_ = loaded_callback; | 277 loaded_callback_ = loaded_callback; |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 EXPECT_EQ(2U, cookies.size()); | 989 EXPECT_EQ(2U, cookies.size()); |
991 // this deletes the callback | 990 // this deletes the callback |
992 handle.reset(); | 991 handle.reset(); |
993 SetSystemCookie(kTestCookieURL, "abc", "jkl"); | 992 SetSystemCookie(kTestCookieURL, "abc", "jkl"); |
994 EXPECT_EQ(2U, cookies.size()); | 993 EXPECT_EQ(2U, cookies.size()); |
995 DeleteSystemCookie(kTestCookieURL, "abc"); | 994 DeleteSystemCookie(kTestCookieURL, "abc"); |
996 store_->UnSynchronize(); | 995 store_->UnSynchronize(); |
997 } | 996 } |
998 | 997 |
999 } // namespace net | 998 } // namespace net |
OLD | NEW |