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

Side by Side Diff: ios/net/cookies/cookie_store_ios.h

Issue 2597933003: [ios] Removed CookieStoreIOS::UnSynchronize. (Closed)
Patch Set: Actually fixed compilation Created 3 years, 12 months 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 unified diff | Download patch
« no previous file with comments | « ios/chrome/app/main_controller.mm ('k') | ios/net/cookies/cookie_store_ios.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 5 #ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
6 #define IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 6 #define IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 enum CookiePolicy { ALLOW, BLOCK }; 76 enum CookiePolicy { ALLOW, BLOCK };
77 77
78 // Create an instance of CookieStoreIOS that is generated from the cookies 78 // Create an instance of CookieStoreIOS that is generated from the cookies
79 // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage| 79 // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage|
80 // as its default backend and is initially synchronized with it. 80 // as its default backend and is initially synchronized with it.
81 // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage, 81 // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage,
82 // so callers should not expect these values to be populated. 82 // so callers should not expect these values to be populated.
83 static std::unique_ptr<CookieStoreIOS> CreateCookieStore( 83 static std::unique_ptr<CookieStoreIOS> CreateCookieStore(
84 NSHTTPCookieStorage* cookie_storage); 84 NSHTTPCookieStorage* cookie_storage);
85 85
86 // As there is only one system store, only one CookieStoreIOS at a time may
87 // be synchronized with it.
88 static void SwitchSynchronizedStore(CookieStoreIOS* old_store,
89 CookieStoreIOS* new_store);
90
91 // Must be called when the state of 86 // Must be called when the state of
92 // |NSHTTPCookieStorage sharedHTTPCookieStorage| changes. 87 // |NSHTTPCookieStorage sharedHTTPCookieStorage| changes.
93 // Affects only those CookieStoreIOS instances that are backed by 88 // Affects only those CookieStoreIOS instances that are backed by
94 // |NSHTTPCookieStorage sharedHTTPCookieStorage|. 89 // |NSHTTPCookieStorage sharedHTTPCookieStorage|.
95 static void NotifySystemCookiesChanged(); 90 static void NotifySystemCookiesChanged();
96 91
97 // Unsynchronizes the cookie store if it is currently synchronized.
98 void UnSynchronize();
99
100 // Only one cookie store may enable metrics. 92 // Only one cookie store may enable metrics.
101 void SetMetricsEnabled(); 93 void SetMetricsEnabled();
102 94
103 // Sets the delay between flushes. Only used in tests. 95 // Sets the delay between flushes. Only used in tests.
104 void set_flush_delay_for_testing(base::TimeDelta delay) { 96 void set_flush_delay_for_testing(base::TimeDelta delay) {
105 flush_delay_ = delay; 97 flush_delay_ = delay;
106 } 98 }
107 99
108 // Inherited CookieStore methods. 100 // Inherited CookieStore methods.
109 void SetCookieWithOptionsAsync(const GURL& url, 101 void SetCookieWithOptionsAsync(const GURL& url,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override; 141 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
150 void FlushStore(const base::Closure& callback) override; 142 void FlushStore(const base::Closure& callback) override;
151 143
152 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( 144 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie(
153 const GURL& url, 145 const GURL& url,
154 const std::string& name, 146 const std::string& name,
155 const CookieChangedCallback& callback) override; 147 const CookieChangedCallback& callback) override;
156 148
157 bool IsEphemeral() override; 149 bool IsEphemeral() override;
158 150
151 // Changes the synchronization of the store.
152 // If |synchronized| is true, then the system cookie store is used as a
153 // backend, else |cookie_monster_| is used. Cookies are moved from one to
154 // the other accordingly.
155 // TODO(crbug.com/676144): Remove this method. It is used only in tests.
156 void SetSynchronizedWithSystemStore(bool synchronized);
157
159 private: 158 private:
160 // For tests. 159 // For tests.
161 friend struct CookieStoreIOSTestTraits; 160 friend struct CookieStoreIOSTestTraits;
162 161
163 enum SynchronizationState { 162 enum SynchronizationState {
164 NOT_SYNCHRONIZED, // Uses CookieMonster as backend. 163 NOT_SYNCHRONIZED, // Uses CookieMonster as backend.
165 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster. 164 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster.
166 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend. 165 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend.
167 }; 166 };
168 167
169 // Cookie fliter for DeleteCookiesWithFilter(). 168 // Cookie fliter for DeleteCookiesWithFilter().
170 // Takes a cookie and a creation time and returns true if the cookie must be 169 // Takes a cookie and a creation time and returns true if the cookie must be
171 // deleted. 170 // deleted.
172 typedef base::Callback<bool(NSHTTPCookie*, base::Time)> CookieFilterFunction; 171 typedef base::Callback<bool(NSHTTPCookie*, base::Time)> CookieFilterFunction;
173 172
174 // Clears the system cookie store. 173 // Clears the system cookie store.
175 void ClearSystemStore(); 174 void ClearSystemStore();
176 // Changes the synchronization of the store.
177 // If |synchronized| is true, then the system cookie store is used as a
178 // backend, else |cookie_monster_| is used. Cookies are moved from one to
179 // the other accordingly.
180 void SetSynchronizedWithSystemStore(bool synchronized);
181 // Returns true if the system cookie store policy is 175 // Returns true if the system cookie store policy is
182 // |NSHTTPCookieAcceptPolicyAlways|. 176 // |NSHTTPCookieAcceptPolicyAlways|.
183 bool SystemCookiesAllowed(); 177 bool SystemCookiesAllowed();
184 // Converts |cookies| to NSHTTPCookie and add them to the system store. 178 // Converts |cookies| to NSHTTPCookie and add them to the system store.
185 void AddCookiesToSystemStore(const net::CookieList& cookies); 179 void AddCookiesToSystemStore(const net::CookieList& cookies);
186 // Copies the cookies to the backing CookieMonster. If the cookie store is not 180 // Copies the cookies to the backing CookieMonster. If the cookie store is not
187 // synchronized with the system store, this is a no-op. 181 // synchronized with the system store, this is a no-op.
188 void WriteToCookieMonster(NSArray* system_cookies); 182 void WriteToCookieMonster(NSArray* system_cookies);
189 // Runs all the pending tasks. 183 // Runs all the pending tasks.
190 void RunAllPendingTasks(); 184 void RunAllPendingTasks();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 hook_map_; 314 hook_map_;
321 315
322 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; 316 base::WeakPtrFactory<CookieStoreIOS> weak_factory_;
323 317
324 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); 318 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS);
325 }; 319 };
326 320
327 } // namespace net 321 } // namespace net
328 322
329 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 323 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
OLDNEW
« no previous file with comments | « ios/chrome/app/main_controller.mm ('k') | ios/net/cookies/cookie_store_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698