Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: ios/net/cookies/cookie_store_ios.mm

Issue 2596653003: [ios] Removed CookieStoreIOS::SetCookiePolicy. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/net/cookies/cookie_store_ios.h ('k') | ios/net/cookies/cookie_store_ios_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 edbbb82037aa3f9a193963d71f16645f2669682b..a6d844cd8d59121fbfadaf42fe317ddcc6c3a402 100644
--- a/ios/net/cookies/cookie_store_ios.mm
+++ b/ios/net/cookies/cookie_store_ios.mm
@@ -61,7 +61,6 @@ class NotificationTrampoline {
// Notify the observers.
void NotifyCookiesChanged();
- void NotifyCookiePolicyChanged();
private:
NotificationTrampoline();
@@ -95,11 +94,6 @@ void NotificationTrampoline::NotifyCookiesChanged() {
observer.OnSystemCookiesChanged();
}
-void NotificationTrampoline::NotifyCookiePolicyChanged() {
- for (auto& observer : observer_list_)
- observer.OnSystemCookiePolicyChanged();
-}
-
NotificationTrampoline::NotificationTrampoline() {
}
@@ -317,19 +311,6 @@ CookieStoreIOS::~CookieStoreIOS() {
}
// static
-void CookieStoreIOS::SetCookiePolicy(CookiePolicy setting) {
- NSHTTPCookieAcceptPolicy policy = (setting == ALLOW)
- ? NSHTTPCookieAcceptPolicyAlways
- : NSHTTPCookieAcceptPolicyNever;
- NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage];
- NSHTTPCookieAcceptPolicy current_policy = [store cookieAcceptPolicy];
- if (current_policy == policy)
- return;
- [store setCookieAcceptPolicy:policy];
- NotificationTrampoline::GetInstance()->NotifyCookiePolicyChanged();
-}
-
-// static
std::unique_ptr<CookieStoreIOS> CookieStoreIOS::CreateCookieStore(
NSHTTPCookieStorage* cookie_storage) {
DCHECK(cookie_storage);
@@ -767,44 +748,6 @@ void CookieStoreIOS::ClearSystemStore() {
creation_time_manager_->Clear();
}
-void CookieStoreIOS::OnSystemCookiePolicyChanged() {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- // If the CookieStoreIOS is not synchronized or is not backed by
- // |NSHTTPCookieStorage sharedHTTPCookieStorage| this callback is irrelevant.
- if (synchronization_state_ == NOT_SYNCHRONIZED ||
- system_store_ != [NSHTTPCookieStorage sharedHTTPCookieStorage]) {
- return;
- }
-
- NSHTTPCookieAcceptPolicy policy =
- [system_store_ cookieAcceptPolicy];
- if (policy == NSHTTPCookieAcceptPolicyAlways) {
- // If cookies are disabled, the system cookie store should be empty.
- DCHECK(![[system_store_ cookies] count]);
- DCHECK(synchronization_state_ != SYNCHRONIZING);
- synchronization_state_ = SYNCHRONIZING;
- cookie_monster_->GetAllCookiesAsync(base::Bind(
- &CookieStoreIOS::AddCookiesToSystemStore, weak_factory_.GetWeakPtr()));
- } else {
- DCHECK_EQ(NSHTTPCookieAcceptPolicyNever, policy);
- // FlushStore() does not write the cookies to disk when they are disabled.
- // Explicitly copy them.
- WriteToCookieMonster([system_store_ cookies]);
- FlushStore(base::Closure());
- ClearSystemStore();
- if (synchronization_state_ == SYNCHRONIZING) {
- // If synchronization was in progress, abort it and leave the cookie store
- // empty.
- // Temporarily toggle the synchronization state so that pending tasks are
- // redirected to cookie_monster_ and can complete normally.
- synchronization_state_ = NOT_SYNCHRONIZED;
- RunAllPendingTasks();
- synchronization_state_ = SYNCHRONIZED;
- }
- }
-}
-
void CookieStoreIOS::SetSynchronizedWithSystemStore(bool synchronized) {
DCHECK(thread_checker_.CalledOnValidThread());
« no previous file with comments | « ios/net/cookies/cookie_store_ios.h ('k') | ios/net/cookies/cookie_store_ios_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698