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

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

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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/net/clients/crn_network_client_protocol.h ('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 <string> 10 #include <string>
10 #include <utility> 11 #include <utility>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/cancelable_callback.h" 15 #include "base/cancelable_callback.h"
15 #include "base/mac/scoped_nsobject.h" 16 #include "base/mac/scoped_nsobject.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "ios/net/cookies/cookie_cache.h" 21 #include "ios/net/cookies/cookie_cache.h"
22 #include "net/cookies/cookie_monster.h" 22 #include "net/cookies/cookie_monster.h"
23 #include "net/cookies/cookie_store.h" 23 #include "net/cookies/cookie_store.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 @class NSHTTPCookie; 26 @class NSHTTPCookie;
27 @class NSHTTPCookieStorage; 27 @class NSHTTPCookieStorage;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Must be called on the thread where CookieStoreIOS instances live. 81 // Must be called on the thread where CookieStoreIOS instances live.
82 // Affects only those CookieStoreIOS instances that are backed by 82 // Affects only those CookieStoreIOS instances that are backed by
83 // |NSHTTPCookieStorage sharedHTTPCookieStorage|. 83 // |NSHTTPCookieStorage sharedHTTPCookieStorage|.
84 static void SetCookiePolicy(CookiePolicy setting); 84 static void SetCookiePolicy(CookiePolicy setting);
85 85
86 // Create an instance of CookieStoreIOS that is generated from the cookies 86 // Create an instance of CookieStoreIOS that is generated from the cookies
87 // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage| 87 // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage|
88 // as its default backend and is initially synchronized with it. 88 // as its default backend and is initially synchronized with it.
89 // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage, 89 // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage,
90 // so callers should not expect these values to be populated. 90 // so callers should not expect these values to be populated.
91 static scoped_ptr<CookieStoreIOS> CreateCookieStore( 91 static std::unique_ptr<CookieStoreIOS> CreateCookieStore(
92 NSHTTPCookieStorage* cookie_storage); 92 NSHTTPCookieStorage* cookie_storage);
93 93
94 // As there is only one system store, only one CookieStoreIOS at a time may 94 // As there is only one system store, only one CookieStoreIOS at a time may
95 // be synchronized with it. 95 // be synchronized with it.
96 static void SwitchSynchronizedStore(CookieStoreIOS* old_store, 96 static void SwitchSynchronizedStore(CookieStoreIOS* old_store,
97 CookieStoreIOS* new_store); 97 CookieStoreIOS* new_store);
98 98
99 // Must be called when the state of 99 // Must be called when the state of
100 // |NSHTTPCookieStorage sharedHTTPCookieStorage| changes. 100 // |NSHTTPCookieStorage sharedHTTPCookieStorage| changes.
101 // Affects only those CookieStoreIOS instances that are backed by 101 // Affects only those CookieStoreIOS instances that are backed by
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 const base::Time& delete_end, 150 const base::Time& delete_end,
151 const DeleteCallback& callback) override; 151 const DeleteCallback& callback) override;
152 void DeleteAllCreatedBetweenForHostAsync( 152 void DeleteAllCreatedBetweenForHostAsync(
153 const base::Time delete_begin, 153 const base::Time delete_begin,
154 const base::Time delete_end, 154 const base::Time delete_end,
155 const GURL& url, 155 const GURL& url,
156 const DeleteCallback& callback) override; 156 const DeleteCallback& callback) override;
157 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override; 157 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
158 void FlushStore(const base::Closure& callback) override; 158 void FlushStore(const base::Closure& callback) override;
159 159
160 scoped_ptr<CookieChangedSubscription> AddCallbackForCookie( 160 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie(
161 const GURL& url, 161 const GURL& url,
162 const std::string& name, 162 const std::string& name,
163 const CookieChangedCallback& callback) override; 163 const CookieChangedCallback& callback) override;
164 164
165 bool IsEphemeral() override; 165 bool IsEphemeral() override;
166 166
167 private: 167 private:
168 // For tests. 168 // For tests.
169 friend struct CookieStoreIOSTestTraits; 169 friend struct CookieStoreIOSTestTraits;
170 170
(...skipping 26 matching lines...) Expand all
197 // Runs all the pending tasks. 197 // Runs all the pending tasks.
198 void RunAllPendingTasks(); 198 void RunAllPendingTasks();
199 199
200 // Inherited CookieNotificationObserver methods. 200 // Inherited CookieNotificationObserver methods.
201 void OnSystemCookiesChanged() override; 201 void OnSystemCookiesChanged() override;
202 void OnSystemCookiePolicyChanged() override; 202 void OnSystemCookiePolicyChanged() override;
203 203
204 void DeleteCookiesWithFilter(const CookieFilterFunction& filter, 204 void DeleteCookiesWithFilter(const CookieFilterFunction& filter,
205 const DeleteCallback& callback); 205 const DeleteCallback& callback);
206 206
207 scoped_ptr<net::CookieMonster> cookie_monster_; 207 std::unique_ptr<net::CookieMonster> cookie_monster_;
208 base::scoped_nsobject<NSHTTPCookieStorage> system_store_; 208 base::scoped_nsobject<NSHTTPCookieStorage> system_store_;
209 scoped_ptr<CookieCreationTimeManager> creation_time_manager_; 209 std::unique_ptr<CookieCreationTimeManager> creation_time_manager_;
210 bool metrics_enabled_; 210 bool metrics_enabled_;
211 base::TimeDelta flush_delay_; 211 base::TimeDelta flush_delay_;
212 base::CancelableClosure flush_closure_; 212 base::CancelableClosure flush_closure_;
213 213
214 SynchronizationState synchronization_state_; 214 SynchronizationState synchronization_state_;
215 // Tasks received when SYNCHRONIZING are queued and run when SYNCHRONIZED. 215 // Tasks received when SYNCHRONIZING are queued and run when SYNCHRONIZED.
216 std::vector<base::Closure> tasks_pending_synchronization_; 216 std::vector<base::Closure> tasks_pending_synchronization_;
217 217
218 base::ThreadChecker thread_checker_; 218 base::ThreadChecker thread_checker_;
219 219
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // callback that invokes UpdateCachesFromCookieMonster() to schedule an 314 // callback that invokes UpdateCachesFromCookieMonster() to schedule an
315 // asynchronous synchronization of the cookie cache and then calls the 315 // asynchronous synchronization of the cookie cache and then calls the
316 // original callback. 316 // original callback.
317 317
318 SetCookiesCallback WrapSetCallback(const SetCookiesCallback& callback); 318 SetCookiesCallback WrapSetCallback(const SetCookiesCallback& callback);
319 DeleteCallback WrapDeleteCallback(const DeleteCallback& callback); 319 DeleteCallback WrapDeleteCallback(const DeleteCallback& callback);
320 base::Closure WrapClosure(const base::Closure& callback); 320 base::Closure WrapClosure(const base::Closure& callback);
321 321
322 // Cached values of system cookies. Only cookies which have an observer added 322 // Cached values of system cookies. Only cookies which have an observer added
323 // with AddCallbackForCookie are kept in this cache. 323 // with AddCallbackForCookie are kept in this cache.
324 scoped_ptr<CookieCache> cookie_cache_; 324 std::unique_ptr<CookieCache> cookie_cache_;
325 325
326 // Callbacks for cookie changes installed by AddCallbackForCookie. 326 // Callbacks for cookie changes installed by AddCallbackForCookie.
327 typedef std::map<std::pair<GURL, std::string>, CookieChangedCallbackList*> 327 typedef std::map<std::pair<GURL, std::string>, CookieChangedCallbackList*>
328 CookieChangedHookMap; 328 CookieChangedHookMap;
329 CookieChangedHookMap hook_map_; 329 CookieChangedHookMap hook_map_;
330 330
331 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; 331 base::WeakPtrFactory<CookieStoreIOS> weak_factory_;
332 332
333 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); 333 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS);
334 }; 334 };
335 335
336 } // namespace net 336 } // namespace net
337 337
338 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 338 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
OLDNEW
« no previous file with comments | « ios/net/clients/crn_network_client_protocol.h ('k') | ios/net/cookies/cookie_store_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698