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

Side by Side Diff: content/browser/net/quota_policy_cookie_store.h

Issue 1016643004: Moves SQLitePersistentCookieStore to net/extras/sqlite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cookies
Patch Set: Better timestamp fix. Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
Ryan Sleevi 2015/05/06 00:44:18 no (c)
rohitrao (ping after 24h) 2015/05/11 19:25:30 Done.
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 // A sqlite implementation of a cookie monster persistent store. 5 // A cookie monster persistent store that deletes session cookies on shutdown.
6 6
7 #ifndef CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 7 #ifndef CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_
8 #define CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 8 #define CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "net/cookies/cookie_monster.h" 17 #include "net/cookies/cookie_monster.h"
18 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
18 19
19 class Task; 20 class Task;
20 21
21 namespace base { 22 namespace base {
22 class FilePath; 23 class FilePath;
23 class SequencedTaskRunner; 24 class SequencedTaskRunner;
24 } 25 }
25 26
26 namespace net { 27 namespace net {
27 class CanonicalCookie; 28 class CanonicalCookie;
28 class CookieCryptoDelegate; 29 class CookieCryptoDelegate;
29 } 30 }
30 31
31 namespace storage { 32 namespace storage {
32 class SpecialStoragePolicy; 33 class SpecialStoragePolicy;
33 } 34 }
34 35
35 namespace content { 36 namespace content {
36 37
37 // Implements the PersistentCookieStore interface in terms of a SQLite database. 38 // Implements a PersistentCookieStore that deletes session cookies on
38 // For documentation about the actual member functions consult the documentation 39 // shutdown. For documentation about the actual member functions consult the
39 // of the parent class |net::CookieMonster::PersistentCookieStore|. 40 // parent class |net::CookieMonster::PersistentCookieStore|. If provided, a
40 // If provided, a |SpecialStoragePolicy| is consulted when the SQLite database 41 // |SpecialStoragePolicy| is consulted when the SQLite database is closed to
41 // is closed to decide which cookies to keep. 42 // decide which cookies to keep.
42 class CONTENT_EXPORT SQLitePersistentCookieStore 43 class CONTENT_EXPORT QuotaPolicyCookieStore
43 : public net::CookieMonster::PersistentCookieStore { 44 : public net::CookieMonster::PersistentCookieStore {
44 public: 45 public:
45 // All blocking database accesses will be performed on 46 // All blocking database accesses will be performed on
46 // |background_task_runner|, while |client_task_runner| is used to invoke 47 // |background_task_runner|, while |client_task_runner| is used to invoke
47 // callbacks. 48 // callbacks.
48 SQLitePersistentCookieStore( 49 QuotaPolicyCookieStore(
49 const base::FilePath& path, 50 const base::FilePath& path,
50 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, 51 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
51 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 52 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
52 bool restore_old_session_cookies, 53 bool restore_old_session_cookies,
53 storage::SpecialStoragePolicy* special_storage_policy, 54 storage::SpecialStoragePolicy* special_storage_policy,
54 net::CookieCryptoDelegate* crypto_delegate); 55 net::CookieCryptoDelegate* crypto_delegate);
55 56
56 // net::CookieMonster::PersistentCookieStore: 57 // net::CookieMonster::PersistentCookieStore:
57 void Load(const LoadedCallback& loaded_callback) override; 58 void Load(const LoadedCallback& loaded_callback) override;
58 void LoadCookiesForKey(const std::string& key, 59 void LoadCookiesForKey(const std::string& key,
59 const LoadedCallback& callback) override; 60 const LoadedCallback& callback) override;
60 void AddCookie(const net::CanonicalCookie& cc) override; 61 void AddCookie(const net::CanonicalCookie& cc) override;
61 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override; 62 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override;
62 void DeleteCookie(const net::CanonicalCookie& cc) override; 63 void DeleteCookie(const net::CanonicalCookie& cc) override;
63 void SetForceKeepSessionState() override; 64 void SetForceKeepSessionState() override;
64 void Flush(const base::Closure& callback) override; 65 void Flush(const base::Closure& callback) override;
65 66
66 protected: 67 private:
67 ~SQLitePersistentCookieStore() override; 68 ~QuotaPolicyCookieStore() override;
68 69
69 private: 70 void OnLoad(const LoadedCallback& loaded_callback,
70 class Backend; 71 const std::vector<net::CanonicalCookie*>& cookies);
Ryan Sleevi 2015/05/06 00:44:18 Document?
rohitrao (ping after 24h) 2015/05/11 19:25:30 Done.
71 72
72 scoped_refptr<Backend> backend_; 73 // Map of (domain keys(eTLD+1), is secure cookie) to number of cookies in the
74 // database.
75 typedef std::map<net::SQLitePersistentCookieStore::CookieOrigin, int>
Ryan Sleevi 2015/05/06 00:44:18 int? not size_t?
rohitrao (ping after 24h) 2015/05/11 19:25:30 Done.
76 CookiesPerOriginMap;
77 CookiesPerOriginMap cookies_per_origin_;
73 78
74 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); 79 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
80 scoped_refptr<net::SQLitePersistentCookieStore> persistent_store_;
81
82 DISALLOW_COPY_AND_ASSIGN(QuotaPolicyCookieStore);
75 }; 83 };
76 84
77 } // namespace content 85 } // namespace content
78 86
79 #endif // CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 87 #endif // CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698