Chromium Code Reviews| Index: ios/net/cookies/cookie_store_ios_persistent.mm |
| diff --git a/ios/net/cookies/cookie_store_ios_persistent.mm b/ios/net/cookies/cookie_store_ios_persistent.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3301eed5ebdf4f32d7c0e969b0593748b8ae4cf1 |
| --- /dev/null |
| +++ b/ios/net/cookies/cookie_store_ios_persistent.mm |
| @@ -0,0 +1,141 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ios/net/cookies/cookie_store_ios_persistent.h" |
|
Eugene But (OOO till 7-30)
2017/01/23 17:37:48
s/include/import
maksims (do not use this acc)
2017/01/24 10:23:46
Done.
|
| + |
| +#import <Foundation/Foundation.h> |
| + |
| +#include "ios/net/cookies/system_cookie_util.h" |
| +#include "net/cookies/cookie_monster.h" |
| + |
| +namespace net { |
| + |
| +#pragma mark - |
| +#pragma mark CookieStoreIOSPersistent |
| + |
| +CookieStoreIOSPersistent::CookieStoreIOSPersistent( |
| + net::CookieMonster::PersistentCookieStore* persistent_store) |
| + : CookieStoreIOS(SynchronizationState::NOT_SYNCHRONIZED, |
| + persistent_store, |
| + [NSHTTPCookieStorage sharedHTTPCookieStorage]) {} |
| + |
| +CookieStoreIOSPersistent::~CookieStoreIOSPersistent() {} |
| + |
| +#pragma mark - |
| +#pragma mark CookieStoreIOSPersistent methods |
| + |
| +void CookieStoreIOSPersistent::SetCookieWithOptionsAsync( |
| + const GURL& url, |
| + const std::string& cookie_line, |
| + const net::CookieOptions& options, |
| + const SetCookiesCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + cookie_monster()->SetCookieWithOptionsAsync(url, cookie_line, options, |
| + WrapSetCallback(callback)); |
| +} |
| + |
| +void CookieStoreIOSPersistent::SetCookieWithDetailsAsync( |
| + const GURL& url, |
| + const std::string& name, |
| + const std::string& value, |
| + const std::string& domain, |
| + const std::string& path, |
| + base::Time creation_time, |
| + base::Time expiration_time, |
| + base::Time last_access_time, |
| + bool secure, |
| + bool http_only, |
| + CookieSameSite same_site, |
| + bool enforce_strict_secure, |
| + CookiePriority priority, |
| + const SetCookiesCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + cookie_monster()->SetCookieWithDetailsAsync( |
| + url, name, value, domain, path, creation_time, expiration_time, |
| + last_access_time, secure, http_only, same_site, enforce_strict_secure, |
| + priority, WrapSetCallback(callback)); |
| +} |
| + |
| +void CookieStoreIOSPersistent::GetCookiesWithOptionsAsync( |
| + const GURL& url, |
| + const net::CookieOptions& options, |
| + const GetCookiesCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + cookie_monster()->GetCookiesWithOptionsAsync(url, options, callback); |
| +} |
| + |
| +void CookieStoreIOSPersistent::GetCookieListWithOptionsAsync( |
| + const GURL& url, |
| + const net::CookieOptions& options, |
| + const GetCookieListCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + cookie_monster()->GetCookieListWithOptionsAsync(url, options, callback); |
| +} |
| + |
| +void CookieStoreIOSPersistent::GetAllCookiesAsync( |
| + const GetCookieListCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + cookie_monster()->GetAllCookiesAsync(callback); |
| +} |
| + |
| +void CookieStoreIOSPersistent::DeleteCookieAsync( |
| + const GURL& url, |
| + const std::string& cookie_name, |
| + const base::Closure& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + cookie_monster()->DeleteCookieAsync(url, cookie_name, WrapClosure(callback)); |
| +} |
| + |
| +void CookieStoreIOSPersistent::DeleteCanonicalCookieAsync( |
| + const CanonicalCookie& cookie, |
| + const DeleteCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + cookie_monster()->DeleteCanonicalCookieAsync(cookie, |
| + WrapDeleteCallback(callback)); |
| +} |
| + |
| +void CookieStoreIOSPersistent::DeleteAllCreatedBetweenAsync( |
| + const base::Time& delete_begin, |
| + const base::Time& delete_end, |
| + const DeleteCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + if (metrics_enabled()) |
| + ResetCookieCountMetrics(); |
| + |
| + cookie_monster()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, |
| + WrapDeleteCallback(callback)); |
| +} |
| + |
| +void CookieStoreIOSPersistent::DeleteAllCreatedBetweenWithPredicateAsync( |
| + const base::Time& delete_begin, |
| + const base::Time& delete_end, |
| + const CookiePredicate& predicate, |
| + const DeleteCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + if (metrics_enabled()) |
| + ResetCookieCountMetrics(); |
| + |
| + cookie_monster()->DeleteAllCreatedBetweenWithPredicateAsync( |
| + delete_begin, delete_end, predicate, WrapDeleteCallback(callback)); |
| +} |
| + |
| +void CookieStoreIOSPersistent::DeleteSessionCookiesAsync( |
| + const DeleteCallback& callback) { |
| + DCHECK(thread_checker().CalledOnValidThread()); |
| + |
| + if (metrics_enabled()) |
| + ResetCookieCountMetrics(); |
| + |
| + cookie_monster()->DeleteSessionCookiesAsync(WrapDeleteCallback(callback)); |
| +} |
| + |
| +} // namespace net |