| Index: ios/net/cookies/cookie_store_ios.mm
|
| diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm
|
| index 685324468a085d46ab14fdd7afe968470580c262..adc99e0797cd7a9167c049a3eec0c2fcdf0612b6 100644
|
| --- a/ios/net/cookies/cookie_store_ios.mm
|
| +++ b/ios/net/cookies/cookie_store_ios.mm
|
| @@ -274,33 +274,14 @@ bool HasExplicitDomain(const std::string& cookie_line) {
|
| #pragma mark -
|
| #pragma mark CookieStoreIOS
|
|
|
| -CookieStoreIOS::CookieStoreIOS(
|
| - net::CookieMonster::PersistentCookieStore* persistent_store)
|
| - : CookieStoreIOS(persistent_store,
|
| - [NSHTTPCookieStorage sharedHTTPCookieStorage]) {
|
| -}
|
| +CookieStoreIOS::CookieStoreIOS(NSHTTPCookieStorage* cookie_storage)
|
| + : CookieStoreIOS(SYNCHRONIZED, nullptr, cookie_storage) {}
|
|
|
| CookieStoreIOS::~CookieStoreIOS() {
|
| NotificationTrampoline::GetInstance()->RemoveObserver(this);
|
| }
|
|
|
| // static
|
| -std::unique_ptr<CookieStoreIOS> CookieStoreIOS::CreateCookieStore(
|
| - NSHTTPCookieStorage* cookie_storage) {
|
| - DCHECK(cookie_storage);
|
| - // TODO(huey): Update this when CrNet supports multiple cookie jars.
|
| - [cookie_storage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
|
| -
|
| - // Create a cookie store with no persistent store backing. Then, populate
|
| - // it from the system's cookie jar.
|
| - std::unique_ptr<CookieStoreIOS> cookie_store(
|
| - new CookieStoreIOS(nullptr, cookie_storage));
|
| - cookie_store->synchronization_state_ = SYNCHRONIZED;
|
| - cookie_store->FlushStore(base::Closure());
|
| - return cookie_store;
|
| -}
|
| -
|
| -// static
|
| void CookieStoreIOS::NotifySystemCookiesChanged() {
|
| NotificationTrampoline::GetInstance()->NotifyCookiesChanged();
|
| }
|
| @@ -323,57 +304,49 @@ void CookieStoreIOS::SetCookieWithOptionsAsync(
|
| const SetCookiesCallback& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->SetCookieWithOptionsAsync(url, cookie_line, options,
|
| - WrapSetCallback(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - // The exclude_httponly() option would only be used by a javascript
|
| - // engine.
|
| - DCHECK(!options.exclude_httponly());
|
| - // If cookies are not allowed, they are stashed in the CookieMonster, and
|
| - // should be written there instead.
|
| - DCHECK(SystemCookiesAllowed());
|
| -
|
| - base::Time server_time =
|
| - options.has_server_time() ? options.server_time() : base::Time();
|
| - NSHTTPCookie* cookie =
|
| - GetNSHTTPCookieFromCookieLine(cookie_line, url, server_time);
|
| - DLOG_IF(WARNING, !cookie)
|
| - << "Could not create cookie for line: " << cookie_line;
|
| -
|
| - // On iOS, [cookie domain] is not empty when the cookie domain is not
|
| - // specified: it is inferred from the URL instead. The only case when it
|
| - // is empty is when the domain attribute is incorrectly formatted.
|
| - std::string domain_string(base::SysNSStringToUTF8([cookie domain]));
|
| - std::string dummy;
|
| - bool has_explicit_domain = HasExplicitDomain(cookie_line);
|
| - bool has_valid_domain =
|
| - net::cookie_util::GetCookieDomainWithString(
|
| - url, domain_string, &dummy);
|
| - // A cookie can be set if all of:
|
| - // a) The cookie line is well-formed
|
| - // b) The Domain attribute, if present, was not malformed
|
| - // c) At least one of:
|
| - // 1) The cookie had no explicit Domain, so the Domain was inferred
|
| - // from the URL, or
|
| - // 2) The cookie had an explicit Domain for which the URL is allowed
|
| - // to set cookies.
|
| - bool success = (cookie != nil) && !domain_string.empty() &&
|
| - (!has_explicit_domain || has_valid_domain);
|
| -
|
| - if (success) {
|
| - [system_store_ setCookie:cookie];
|
| - creation_time_manager_->SetCreationTime(
|
| - cookie,
|
| - creation_time_manager_->MakeUniqueCreationTime(base::Time::Now()));
|
| - }
|
| -
|
| - if (!callback.is_null())
|
| - callback.Run(success);
|
| - break;
|
| + // The exclude_httponly() option would only be used by a javascript
|
| + // engine.
|
| + DCHECK(!options.exclude_httponly());
|
| +
|
| + // If cookies are not allowed, they are stashed in the CookieMonster, and
|
| + // should be written there instead.
|
| + DCHECK(SystemCookiesAllowed());
|
| +
|
| + base::Time server_time =
|
| + options.has_server_time() ? options.server_time() : base::Time();
|
| + NSHTTPCookie* cookie =
|
| + GetNSHTTPCookieFromCookieLine(cookie_line, url, server_time);
|
| + DLOG_IF(WARNING, !cookie) << "Could not create cookie for line: "
|
| + << cookie_line;
|
| +
|
| + // On iOS, [cookie domain] is not empty when the cookie domain is not
|
| + // specified: it is inferred from the URL instead. The only case when it
|
| + // is empty is when the domain attribute is incorrectly formatted.
|
| + std::string domain_string(base::SysNSStringToUTF8([cookie domain]));
|
| + std::string dummy;
|
| + bool has_explicit_domain = HasExplicitDomain(cookie_line);
|
| + bool has_valid_domain =
|
| + net::cookie_util::GetCookieDomainWithString(url, domain_string, &dummy);
|
| + // A cookie can be set if all of:
|
| + // a) The cookie line is well-formed
|
| + // b) The Domain attribute, if present, was not malformed
|
| + // c) At least one of:
|
| + // 1) The cookie had no explicit Domain, so the Domain was inferred
|
| + // from the URL, or
|
| + // 2) The cookie had an explicit Domain for which the URL is allowed
|
| + // to set cookies.
|
| + bool success = (cookie != nil) && !domain_string.empty() &&
|
| + (!has_explicit_domain || has_valid_domain);
|
| +
|
| + if (success) {
|
| + [system_store_ setCookie:cookie];
|
| + creation_time_manager_->SetCreationTime(
|
| + cookie,
|
| + creation_time_manager_->MakeUniqueCreationTime(base::Time::Now()));
|
| }
|
| +
|
| + if (!callback.is_null())
|
| + callback.Run(success);
|
| }
|
|
|
| void CookieStoreIOS::SetCookieWithDetailsAsync(
|
| @@ -392,48 +365,36 @@ void CookieStoreIOS::SetCookieWithDetailsAsync(
|
| CookiePriority priority,
|
| const SetCookiesCallback& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| + // If cookies are not allowed, they are stashed in the CookieMonster, and
|
| + // should be written there instead.
|
| + DCHECK(SystemCookiesAllowed());
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->SetCookieWithDetailsAsync(
|
| + bool success = false;
|
| +
|
| + if (creation_time.is_null())
|
| + creation_time = base::Time::Now();
|
| +
|
| + // First create a CanonicalCookie, to normalize the arguments,
|
| + // particularly domain and path, and perform validation.
|
| + std::unique_ptr<net::CanonicalCookie> canonical_cookie =
|
| + net::CanonicalCookie::Create(
|
| url, name, value, domain, path, creation_time, expiration_time,
|
| - last_access_time, secure, http_only, same_site, enforce_strict_secure,
|
| - priority, WrapSetCallback(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - // If cookies are not allowed, they are stashed in the CookieMonster, and
|
| - // should be written there instead.
|
| - DCHECK(SystemCookiesAllowed());
|
| -
|
| - bool success = false;
|
| -
|
| - if (creation_time.is_null())
|
| - creation_time = base::Time::Now();
|
| -
|
| - // First create a CanonicalCookie, to normalize the arguments,
|
| - // particularly domain and path, and perform validation.
|
| - std::unique_ptr<net::CanonicalCookie> canonical_cookie =
|
| - net::CanonicalCookie::Create(
|
| - url, name, value, domain, path, creation_time, expiration_time,
|
| - secure, http_only, same_site, enforce_strict_secure, priority);
|
| -
|
| - if (canonical_cookie) {
|
| - NSHTTPCookie* cookie =
|
| - SystemCookieFromCanonicalCookie(*canonical_cookie);
|
| -
|
| - if (cookie != nil) {
|
| - [system_store_ setCookie:cookie];
|
| - creation_time_manager_->SetCreationTime(
|
| - cookie, creation_time_manager_->MakeUniqueCreationTime(
|
| - canonical_cookie->CreationDate()));
|
| - success = true;
|
| - }
|
| - }
|
| -
|
| - if (!callback.is_null())
|
| - callback.Run(success);
|
| - break;
|
| + secure, http_only, same_site, enforce_strict_secure, priority);
|
| +
|
| + if (canonical_cookie) {
|
| + NSHTTPCookie* cookie = SystemCookieFromCanonicalCookie(*canonical_cookie);
|
| +
|
| + if (cookie != nil) {
|
| + [system_store_ setCookie:cookie];
|
| + creation_time_manager_->SetCreationTime(
|
| + cookie, creation_time_manager_->MakeUniqueCreationTime(
|
| + canonical_cookie->CreationDate()));
|
| + success = true;
|
| + }
|
| }
|
| +
|
| + if (!callback.is_null())
|
| + callback.Run(success);
|
| }
|
|
|
| void CookieStoreIOS::GetCookiesWithOptionsAsync(
|
| @@ -442,26 +403,19 @@ void CookieStoreIOS::GetCookiesWithOptionsAsync(
|
| const GetCookiesCallback& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->GetCookiesWithOptionsAsync(url, options, callback);
|
| - break;
|
| - case SYNCHRONIZED:
|
| - // If cookies are not allowed, they are stashed in the CookieMonster, and
|
| - // should be read from there instead.
|
| - DCHECK(SystemCookiesAllowed());
|
| - // The exclude_httponly() option would only be used by a javascript
|
| - // engine.
|
| - DCHECK(!options.exclude_httponly());
|
| -
|
| - // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass
|
| - // options in here as well. https://crbug.com/459154
|
| - NSArray* cookies = GetCookiesForURL(system_store_,
|
| - url, creation_time_manager_.get());
|
| - if (!callback.is_null())
|
| - callback.Run(BuildCookieLineWithOptions(cookies, options));
|
| - break;
|
| - }
|
| + // If cookies are not allowed, they are stashed in the CookieMonster, and
|
| + // should be read from there instead.
|
| + DCHECK(SystemCookiesAllowed());
|
| + // The exclude_httponly() option would only be used by a javascript
|
| + // engine.
|
| + DCHECK(!options.exclude_httponly());
|
| +
|
| + // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass
|
| + // options in here as well. https://crbug.com/459154
|
| + NSArray* cookies =
|
| + GetCookiesForURL(system_store_, url, creation_time_manager_.get());
|
| + if (!callback.is_null())
|
| + callback.Run(BuildCookieLineWithOptions(cookies, options));
|
| }
|
|
|
| void CookieStoreIOS::GetCookieListWithOptionsAsync(
|
| @@ -469,54 +423,36 @@ void CookieStoreIOS::GetCookieListWithOptionsAsync(
|
| const net::CookieOptions& options,
|
| const GetCookieListCallback& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| -
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback);
|
| - break;
|
| - case SYNCHRONIZED:
|
| - if (!SystemCookiesAllowed()) {
|
| - // If cookies are not allowed, the cookies are stashed in the
|
| - // CookieMonster, so get them from there.
|
| - cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback);
|
| - return;
|
| - }
|
| -
|
| - // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass
|
| - // options in here as well. https://crbug.com/459154
|
| - NSArray* cookies = GetCookiesForURL(system_store_,
|
| - url, creation_time_manager_.get());
|
| - net::CookieList cookie_list = CanonicalCookieListFromSystemCookies(
|
| - cookies);
|
| - if (!callback.is_null())
|
| - callback.Run(cookie_list);
|
| - break;
|
| + if (!SystemCookiesAllowed()) {
|
| + // If cookies are not allowed, the cookies are stashed in the
|
| + // CookieMonster, so get them from there.
|
| + cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback);
|
| + return;
|
| }
|
| +
|
| + // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass
|
| + // options in here as well. https://crbug.com/459154
|
| + NSArray* cookies =
|
| + GetCookiesForURL(system_store_, url, creation_time_manager_.get());
|
| + net::CookieList cookie_list = CanonicalCookieListFromSystemCookies(cookies);
|
| + if (!callback.is_null())
|
| + callback.Run(cookie_list);
|
| }
|
|
|
| void CookieStoreIOS::GetAllCookiesAsync(const GetCookieListCallback& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->GetAllCookiesAsync(callback);
|
| - break;
|
| - case SYNCHRONIZED:
|
| - if (!SystemCookiesAllowed()) {
|
| - // If cookies are not allowed, the cookies are stashed in the
|
| - // CookieMonster, so get them from there.
|
| - cookie_monster_->GetAllCookiesAsync(callback);
|
| - return;
|
| - }
|
| -
|
| - NSArray* cookies = GetAllCookies(system_store_,
|
| - creation_time_manager_.get());
|
| - net::CookieList cookie_list = CanonicalCookieListFromSystemCookies(
|
| - cookies);
|
| - if (!callback.is_null()) {
|
| - callback.Run(cookie_list);
|
| - }
|
| - break;
|
| + if (!SystemCookiesAllowed()) {
|
| + // If cookies are not allowed, the cookies are stashed in the
|
| + // CookieMonster, so get them from there.
|
| + cookie_monster_->GetAllCookiesAsync(callback);
|
| + return;
|
| + }
|
| +
|
| + NSArray* cookies = GetAllCookies(system_store_, creation_time_manager_.get());
|
| + net::CookieList cookie_list = CanonicalCookieListFromSystemCookies(cookies);
|
| + if (!callback.is_null()) {
|
| + callback.Run(cookie_list);
|
| }
|
| }
|
|
|
| @@ -525,25 +461,17 @@ void CookieStoreIOS::DeleteCookieAsync(const GURL& url,
|
| const base::Closure& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->DeleteCookieAsync(url, cookie_name,
|
| - WrapClosure(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - NSArray* cookies = GetCookiesForURL(system_store_,
|
| - url, creation_time_manager_.get());
|
| - for (NSHTTPCookie* cookie in cookies) {
|
| - if ([[cookie name]
|
| - isEqualToString:base::SysUTF8ToNSString(cookie_name)]) {
|
| - [system_store_ deleteCookie:cookie];
|
| - creation_time_manager_->DeleteCreationTime(cookie);
|
| - }
|
| - }
|
| - if (!callback.is_null())
|
| - callback.Run();
|
| - break;
|
| + NSArray* cookies =
|
| + GetCookiesForURL(system_store_, url, creation_time_manager_.get());
|
| + for (NSHTTPCookie* cookie in cookies) {
|
| + if ([[cookie name] isEqualToString:base::SysUTF8ToNSString(cookie_name)]) {
|
| + [system_store_ deleteCookie:cookie];
|
| + creation_time_manager_->DeleteCreationTime(cookie);
|
| + }
|
| }
|
| +
|
| + if (!callback.is_null())
|
| + callback.Run();
|
| }
|
|
|
| void CookieStoreIOS::DeleteCanonicalCookieAsync(
|
| @@ -551,17 +479,10 @@ void CookieStoreIOS::DeleteCanonicalCookieAsync(
|
| const DeleteCallback& callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->DeleteCanonicalCookieAsync(cookie,
|
| - WrapDeleteCallback(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - // This relies on the fact cookies are given unique creation dates.
|
| - CookieFilterFunction filter = base::Bind(
|
| - IsCookieCreatedBetween, cookie.CreationDate(), cookie.CreationDate());
|
| - DeleteCookiesWithFilter(filter, callback);
|
| - }
|
| + // This relies on the fact cookies are given unique creation dates.
|
| + CookieFilterFunction filter = base::Bind(
|
| + IsCookieCreatedBetween, cookie.CreationDate(), cookie.CreationDate());
|
| + DeleteCookiesWithFilter(filter, callback);
|
| }
|
|
|
| void CookieStoreIOS::DeleteAllCreatedBetweenAsync(
|
| @@ -573,17 +494,9 @@ void CookieStoreIOS::DeleteAllCreatedBetweenAsync(
|
| if (metrics_enabled_)
|
| ResetCookieCountMetrics();
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->DeleteAllCreatedBetweenAsync(
|
| - delete_begin, delete_end, WrapDeleteCallback(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - CookieFilterFunction filter =
|
| - base::Bind(&IsCookieCreatedBetween, delete_begin, delete_end);
|
| - DeleteCookiesWithFilter(filter, callback);
|
| - break;
|
| - }
|
| + CookieFilterFunction filter =
|
| + base::Bind(&IsCookieCreatedBetween, delete_begin, delete_end);
|
| + DeleteCookiesWithFilter(filter, callback);
|
| }
|
|
|
| void CookieStoreIOS::DeleteAllCreatedBetweenWithPredicateAsync(
|
| @@ -596,18 +509,9 @@ void CookieStoreIOS::DeleteAllCreatedBetweenWithPredicateAsync(
|
| if (metrics_enabled_)
|
| ResetCookieCountMetrics();
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->DeleteAllCreatedBetweenWithPredicateAsync(
|
| - delete_begin, delete_end, predicate, WrapDeleteCallback(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - CookieFilterFunction filter =
|
| - base::Bind(IsCookieCreatedBetweenWithPredicate, delete_begin,
|
| - delete_end, predicate);
|
| - DeleteCookiesWithFilter(filter, callback);
|
| - break;
|
| - }
|
| + CookieFilterFunction filter = base::Bind(IsCookieCreatedBetweenWithPredicate,
|
| + delete_begin, delete_end, predicate);
|
| + DeleteCookiesWithFilter(filter, callback);
|
| }
|
|
|
| void CookieStoreIOS::DeleteSessionCookiesAsync(const DeleteCallback& callback) {
|
| @@ -616,15 +520,8 @@ void CookieStoreIOS::DeleteSessionCookiesAsync(const DeleteCallback& callback) {
|
| if (metrics_enabled_)
|
| ResetCookieCountMetrics();
|
|
|
| - switch (synchronization_state_) {
|
| - case NOT_SYNCHRONIZED:
|
| - cookie_monster_->DeleteSessionCookiesAsync(WrapDeleteCallback(callback));
|
| - break;
|
| - case SYNCHRONIZED:
|
| - CookieFilterFunction filter = base::Bind(&IsCookieSessionCookie);
|
| - DeleteCookiesWithFilter(filter, callback);
|
| - break;
|
| - }
|
| + CookieFilterFunction filter = base::Bind(&IsCookieSessionCookie);
|
| + DeleteCookiesWithFilter(filter, callback);
|
| }
|
|
|
| void CookieStoreIOS::FlushStore(const base::Closure& closure) {
|
| @@ -640,16 +537,17 @@ void CookieStoreIOS::FlushStore(const base::Closure& closure) {
|
| }
|
|
|
| #pragma mark -
|
| -#pragma mark Private methods
|
| +#pragma mark Protected methods
|
|
|
| CookieStoreIOS::CookieStoreIOS(
|
| + SynchronizationState state,
|
| net::CookieMonster::PersistentCookieStore* persistent_store,
|
| NSHTTPCookieStorage* system_store)
|
| : cookie_monster_(new net::CookieMonster(persistent_store, nullptr)),
|
| system_store_(system_store),
|
| creation_time_manager_(new CookieCreationTimeManager),
|
| metrics_enabled_(false),
|
| - synchronization_state_(NOT_SYNCHRONIZED),
|
| + synchronization_state_(state),
|
| cookie_cache_(new CookieCache()),
|
| weak_factory_(this) {
|
| DCHECK(system_store);
|
| @@ -660,6 +558,29 @@ CookieStoreIOS::CookieStoreIOS(
|
| cookie_monster_->SetForceKeepSessionState();
|
| }
|
|
|
| +CookieStoreIOS::SetCookiesCallback CookieStoreIOS::WrapSetCallback(
|
| + const SetCookiesCallback& callback) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + return base::Bind(&CookieStoreIOS::UpdateCachesAfterSet,
|
| + weak_factory_.GetWeakPtr(), callback);
|
| +}
|
| +
|
| +CookieStoreIOS::DeleteCallback CookieStoreIOS::WrapDeleteCallback(
|
| + const DeleteCallback& callback) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete,
|
| + weak_factory_.GetWeakPtr(), callback);
|
| +}
|
| +
|
| +base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure,
|
| + weak_factory_.GetWeakPtr(), callback);
|
| +}
|
| +
|
| +#pragma mark -
|
| +#pragma mark Private methods
|
| +
|
| void CookieStoreIOS::ClearSystemStore() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| base::scoped_nsobject<NSArray> copy(
|
| @@ -915,24 +836,4 @@ CookieStoreIOS::CanonicalCookieListFromSystemCookies(NSArray* cookies) {
|
| return cookie_list;
|
| }
|
|
|
| -CookieStoreIOS::SetCookiesCallback CookieStoreIOS::WrapSetCallback(
|
| - const SetCookiesCallback& callback) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| - return base::Bind(&CookieStoreIOS::UpdateCachesAfterSet,
|
| - weak_factory_.GetWeakPtr(), callback);
|
| -}
|
| -
|
| -CookieStoreIOS::DeleteCallback CookieStoreIOS::WrapDeleteCallback(
|
| - const DeleteCallback& callback) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| - return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete,
|
| - weak_factory_.GetWeakPtr(), callback);
|
| -}
|
| -
|
| -base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| - return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure,
|
| - weak_factory_.GetWeakPtr(), callback);
|
| -}
|
| -
|
| } // namespace net
|
|
|