OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // A sqlite implementation of a cookie monster persistent store. | 5 // A sqlite implementation of a cookie monster persistent store. |
6 | 6 |
7 #ifndef CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 7 #ifndef NET_EXTRAS_SQLITE_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
8 #define CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 8 #define NET_EXTRAS_SQLITE_SQLITE_PERSISTENT_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" | |
17 #include "net/cookies/cookie_monster.h" | 16 #include "net/cookies/cookie_monster.h" |
18 | 17 |
19 class Task; | 18 class Task; |
20 | 19 |
21 namespace base { | 20 namespace base { |
22 class FilePath; | 21 class FilePath; |
23 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
24 } | 23 } |
25 | 24 |
26 namespace net { | 25 namespace net { |
27 class CanonicalCookie; | 26 class CanonicalCookie; |
28 class CookieCryptoDelegate; | 27 class CookieCryptoDelegate; |
29 } | |
30 | |
31 namespace storage { | |
32 class SpecialStoragePolicy; | |
33 } | |
34 | |
35 namespace content { | |
36 | 28 |
37 // Implements the PersistentCookieStore interface in terms of a SQLite database. | 29 // Implements the PersistentCookieStore interface in terms of a SQLite database. |
38 // For documentation about the actual member functions consult the documentation | 30 // For documentation about the actual member functions consult the documentation |
39 // of the parent class |net::CookieMonster::PersistentCookieStore|. | 31 // of the parent class |CookieMonster::PersistentCookieStore|. |
40 // If provided, a |SpecialStoragePolicy| is consulted when the SQLite database | 32 class SQLitePersistentCookieStore |
41 // is closed to decide which cookies to keep. | 33 : public CookieMonster::PersistentCookieStore { |
42 class CONTENT_EXPORT SQLitePersistentCookieStore | |
43 : public net::CookieMonster::PersistentCookieStore { | |
44 public: | 34 public: |
45 // All blocking database accesses will be performed on | 35 // All blocking database accesses will be performed on |
46 // |background_task_runner|, while |client_task_runner| is used to invoke | 36 // |background_task_runner|, while |client_task_runner| is used to invoke |
47 // callbacks. | 37 // callbacks. |
48 SQLitePersistentCookieStore( | 38 SQLitePersistentCookieStore( |
49 const base::FilePath& path, | 39 const base::FilePath& path, |
50 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, | 40 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, |
51 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, | 41 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
52 bool restore_old_session_cookies, | 42 bool restore_old_session_cookies, |
53 storage::SpecialStoragePolicy* special_storage_policy, | 43 CookieCryptoDelegate* crypto_delegate); |
54 net::CookieCryptoDelegate* crypto_delegate); | |
55 | 44 |
56 // net::CookieMonster::PersistentCookieStore: | 45 // Deletes all of the cookies in |cookies|. |
46 typedef std::pair<std::string, bool> CookieOrigin; | |
47 void DeleteAllInList(std::list<CookieOrigin> cookies); | |
Ryan Sleevi
2015/03/19 03:37:51
Pass by const-ref
rohitrao (ping after 24h)
2015/03/19 14:55:42
Done.
| |
48 | |
49 // CookieMonster::PersistentCookieStore: | |
57 void Load(const LoadedCallback& loaded_callback) override; | 50 void Load(const LoadedCallback& loaded_callback) override; |
58 void LoadCookiesForKey(const std::string& key, | 51 void LoadCookiesForKey(const std::string& key, |
59 const LoadedCallback& callback) override; | 52 const LoadedCallback& callback) override; |
60 void AddCookie(const net::CanonicalCookie& cc) override; | 53 void AddCookie(const CanonicalCookie& cc) override; |
61 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override; | 54 void UpdateCookieAccessTime(const CanonicalCookie& cc) override; |
62 void DeleteCookie(const net::CanonicalCookie& cc) override; | 55 void DeleteCookie(const CanonicalCookie& cc) override; |
63 void SetForceKeepSessionState() override; | 56 void SetForceKeepSessionState() override; |
64 void Flush(const base::Closure& callback) override; | 57 void Flush(const base::Closure& callback) override; |
65 | 58 |
66 protected: | 59 |
60 private: | |
67 ~SQLitePersistentCookieStore() override; | 61 ~SQLitePersistentCookieStore() override; |
68 | 62 |
69 private: | |
70 class Backend; | 63 class Backend; |
71 | 64 |
72 scoped_refptr<Backend> backend_; | 65 scoped_refptr<Backend> backend_; |
73 | 66 |
74 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | 67 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); |
75 }; | 68 }; |
76 | 69 |
77 } // namespace content | 70 } // namespace net |
78 | 71 |
79 #endif // CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 72 #endif // NET_EXTRAS_SQLITE_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
OLD | NEW |