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

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

Issue 2604763003: [ios] Cleaned up comments and tests for CookieStoreIOS synchronization. (Closed)
Patch Set: Removed more obsoleted tests Created 3 years, 11 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 | « no previous file | ios/net/cookies/cookie_store_ios_unittest.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 23 matching lines...) Expand all
34 // Observer for changes on |NSHTTPCookieStorge sharedHTTPCookieStorage|. 34 // Observer for changes on |NSHTTPCookieStorge sharedHTTPCookieStorage|.
35 class CookieNotificationObserver { 35 class CookieNotificationObserver {
36 public: 36 public:
37 // Called when any cookie is added, deleted or changed in 37 // Called when any cookie is added, deleted or changed in
38 // |NSHTTPCookieStorge sharedHTTPCookieStorage|. 38 // |NSHTTPCookieStorge sharedHTTPCookieStorage|.
39 virtual void OnSystemCookiesChanged() = 0; 39 virtual void OnSystemCookiesChanged() = 0;
40 }; 40 };
41 41
42 // The CookieStoreIOS is an implementation of CookieStore relying on 42 // The CookieStoreIOS is an implementation of CookieStore relying on
43 // NSHTTPCookieStorage, ensuring that the cookies are consistent between the 43 // NSHTTPCookieStorage, ensuring that the cookies are consistent between the
44 // network stack and the UIWebViews. 44 // network stack and NSHTTPCookieStorage.
45 // On iOS, the Chrome CookieMonster is not used in conjunction with UIWebView,
46 // because UIWebView expects the cookies to be in the shared
47 // NSHTTPCookieStorage. In particular, javascript may read and write cookies
48 // there.
49 // CookieStoreIOS is not thread safe. 45 // CookieStoreIOS is not thread safe.
50 // 46 //
51 // At any given time, a CookieStoreIOS can either be synchronized with the 47 // CookieStoreIOS can be created synchronized with the system cookie store (via
52 // system cookie store or not. If a CookieStoreIOS is not synchronized with the 48 // CreateCookieStore) or not (other constructors). If a CookieStoreIOS is not
53 // system store, changes are written back to the backing CookieStore. If a 49 // synchronized with the system store, changes are written back to the backing
54 // CookieStoreIOS is synchronized with the system store, changes are written 50 // CookieStore. If a CookieStoreIOS is synchronized with the system store,
55 // directly to the system cookie store, then propagated to the backing store by 51 // changes are written directly to the system cookie store, then propagated to
56 // OnSystemCookiesChanged, which is called by the system store once the change 52 // the backing store by OnSystemCookiesChanged, which is called by the system
57 // to the system store is written back. 53 // store once the change to the system store is written back.
58 //
59 // To unsynchronize, CookieStoreIOS copies the system cookie store into its
60 // backing CookieStore. To synchronize, CookieStoreIOS clears the system cookie
61 // store, copies its backing CookieStore into the system cookie store.
62 class CookieStoreIOS : public net::CookieStore, 54 class CookieStoreIOS : public net::CookieStore,
63 public CookieNotificationObserver { 55 public CookieNotificationObserver {
64 public: 56 public:
65 // Creates a CookieStoreIOS with a default value of 57 // Creates a CookieStoreIOS with a default value of
66 // |NSHTTPCookieStorage sharedCookieStorage| as the system's cookie store. 58 // |NSHTTPCookieStorage sharedCookieStorage| as the system's cookie store.
67 explicit CookieStoreIOS( 59 explicit CookieStoreIOS(
68 net::CookieMonster::PersistentCookieStore* persistent_store); 60 net::CookieMonster::PersistentCookieStore* persistent_store);
69 61
70 explicit CookieStoreIOS( 62 explicit CookieStoreIOS(
71 net::CookieMonster::PersistentCookieStore* persistent_store, 63 net::CookieMonster::PersistentCookieStore* persistent_store,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 hook_map_; 306 hook_map_;
315 307
316 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; 308 base::WeakPtrFactory<CookieStoreIOS> weak_factory_;
317 309
318 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); 310 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS);
319 }; 311 };
320 312
321 } // namespace net 313 } // namespace net
322 314
323 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 315 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
OLDNEW
« no previous file with comments | « no previous file | ios/net/cookies/cookie_store_ios_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698