OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // A cookie monster persistent store that deletes session cookies on shutdown. | |
mef
2015/05/12 21:23:27
this comment seems out of date.
rohitrao (ping after 24h)
2015/05/13 17:05:07
I believe this is correct. The job of this class
| |
6 | |
7 #ifndef CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_ | |
8 #define CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_ | |
9 | |
10 #include <string> | |
11 #include <vector> | |
12 | |
13 #include "base/callback_forward.h" | |
14 #include "base/compiler_specific.h" | |
15 #include "base/memory/ref_counted.h" | |
16 #include "base/memory/scoped_ptr.h" | |
Ryan Sleevi
2015/05/12 00:48:33
Unused
rohitrao (ping after 24h)
2015/05/13 17:05:07
Done.
| |
17 #include "content/common/content_export.h" | |
18 #include "net/cookies/cookie_monster.h" | |
19 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h" | |
Ryan Sleevi
2015/05/12 00:48:33
Strictly speaking, do you have to depend on the SQ
rohitrao (ping after 24h)
2015/05/13 17:05:07
Hmmm. I think we could depend on a CookieMonster:
| |
20 | |
21 class Task; | |
22 | |
23 namespace base { | |
24 class FilePath; | |
25 class SequencedTaskRunner; | |
26 } | |
Ryan Sleevi
2015/05/12 00:48:33
} // namespace base
rohitrao (ping after 24h)
2015/05/13 17:05:07
Done.
| |
27 | |
28 namespace net { | |
29 class CanonicalCookie; | |
30 class CookieCryptoDelegate; | |
31 } | |
Ryan Sleevi
2015/05/12 00:48:33
} // namespace net
rohitrao (ping after 24h)
2015/05/13 17:05:07
Done.
| |
32 | |
33 namespace storage { | |
34 class SpecialStoragePolicy; | |
35 } | |
Ryan Sleevi
2015/05/12 00:48:33
} // namespace storage
rohitrao (ping after 24h)
2015/05/13 17:05:07
Done.
| |
36 | |
37 namespace content { | |
38 | |
39 // Implements a PersistentCookieStore that deletes session cookies on | |
40 // shutdown. For documentation about the actual member functions consult the | |
41 // parent class |net::CookieMonster::PersistentCookieStore|. If provided, a | |
42 // |SpecialStoragePolicy| is consulted when the SQLite database is closed to | |
43 // decide which cookies to keep. | |
44 class CONTENT_EXPORT QuotaPolicyCookieStore | |
45 : public net::CookieMonster::PersistentCookieStore { | |
46 public: | |
47 // Wraps the passed-in |cookie_store|.. | |
Ryan Sleevi
2015/05/12 00:48:34
nit: extra . ?
rohitrao (ping after 24h)
2015/05/13 17:05:07
Done.
| |
48 QuotaPolicyCookieStore( | |
49 scoped_refptr<net::SQLitePersistentCookieStore> cookie_store, | |
Ryan Sleevi
2015/05/12 00:48:33
const-ref unless you want to force callers to .Pas
rohitrao (ping after 24h)
2015/05/13 17:05:07
Done.
| |
50 storage::SpecialStoragePolicy* special_storage_policy); | |
51 | |
52 // net::CookieMonster::PersistentCookieStore: | |
53 void Load(const LoadedCallback& loaded_callback) override; | |
54 void LoadCookiesForKey(const std::string& key, | |
55 const LoadedCallback& callback) override; | |
56 void AddCookie(const net::CanonicalCookie& cc) override; | |
57 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override; | |
58 void DeleteCookie(const net::CanonicalCookie& cc) override; | |
59 void SetForceKeepSessionState() override; | |
60 void Flush(const base::Closure& callback) override; | |
61 | |
62 private: | |
63 typedef std::map<net::SQLitePersistentCookieStore::CookieOrigin, size_t> | |
64 CookiesPerOriginMap; | |
65 | |
66 ~QuotaPolicyCookieStore() override; | |
67 | |
68 // Called after cookies are loaded from the database. Calls |loaded_callback| | |
69 // when done. | |
70 void OnLoad(const LoadedCallback& loaded_callback, | |
71 const std::vector<net::CanonicalCookie*>& cookies); | |
72 | |
73 // Map of (domain keys(eTLD+1), is secure cookie) to number of cookies in the | |
74 // database. | |
75 CookiesPerOriginMap cookies_per_origin_; | |
76 | |
77 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; | |
78 scoped_refptr<net::SQLitePersistentCookieStore> persistent_store_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(QuotaPolicyCookieStore); | |
81 }; | |
82 | |
83 } // namespace content | |
84 | |
85 #endif // CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_ | |
OLD | NEW |