| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 [system_store_ deleteCookie:cookie]; | 613 [system_store_ deleteCookie:cookie]; |
| 614 creation_time_manager_->DeleteCreationTime(cookie); | 614 creation_time_manager_->DeleteCreationTime(cookie); |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 if (!callback.is_null()) | 617 if (!callback.is_null()) |
| 618 callback.Run(); | 618 callback.Run(); |
| 619 break; | 619 break; |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 | 622 |
| 623 void CookieStoreIOS::DeleteCanonicalCookieAsync( |
| 624 const CanonicalCookie& cookie, |
| 625 const DeleteCallback& callback) { |
| 626 DCHECK(thread_checker_.CalledOnValidThread()); |
| 627 |
| 628 switch (synchronization_state_) { |
| 629 case NOT_SYNCHRONIZED: |
| 630 cookie_monster_->DeleteCanonicalCookieAsync(cookie, |
| 631 WrapDeleteCallback(callback)); |
| 632 break; |
| 633 case SYNCHRONIZING: |
| 634 tasks_pending_synchronization_.push_back( |
| 635 base::Bind(&CookieStoreIOS::DeleteCanonicalCookieAsync, this, cookie, |
| 636 WrapDeleteCallback(callback))); |
| 637 break; |
| 638 case SYNCHRONIZED: |
| 639 // This relies on the fact cookies are given unique creation dates. |
| 640 CookieFilterFunction filter = base::Bind( |
| 641 IsCookieCreatedBetween, cookie.CreationDate(), cookie.CreationDate()); |
| 642 DeleteCookiesWithFilter(filter, callback); |
| 643 } |
| 644 } |
| 645 |
| 623 // CookieStoreIOS is an implementation of CookieStore which is not a | 646 // CookieStoreIOS is an implementation of CookieStore which is not a |
| 624 // CookieMonster. As CookieStore is the main cookie API, a caller of | 647 // CookieMonster. As CookieStore is the main cookie API, a caller of |
| 625 // GetCookieMonster must handle the case where this returns null. | 648 // GetCookieMonster must handle the case where this returns null. |
| 626 net::CookieMonster* CookieStoreIOS::GetCookieMonster() { | 649 net::CookieMonster* CookieStoreIOS::GetCookieMonster() { |
| 627 DCHECK(thread_checker_.CalledOnValidThread()); | 650 DCHECK(thread_checker_.CalledOnValidThread()); |
| 628 return nullptr; | 651 return nullptr; |
| 629 } | 652 } |
| 630 | 653 |
| 631 void CookieStoreIOS::DeleteAllCreatedBetweenAsync( | 654 void CookieStoreIOS::DeleteAllCreatedBetweenAsync( |
| 632 const base::Time& delete_begin, | 655 const base::Time& delete_begin, |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 DCHECK(thread_checker_.CalledOnValidThread()); | 1137 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1115 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); | 1138 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); |
| 1116 } | 1139 } |
| 1117 | 1140 |
| 1118 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { | 1141 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { |
| 1119 DCHECK(thread_checker_.CalledOnValidThread()); | 1142 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1120 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); | 1143 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); |
| 1121 } | 1144 } |
| 1122 | 1145 |
| 1123 } // namespace net | 1146 } // namespace net |
| OLD | NEW |