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

Side by Side Diff: net/extras/sqlite/sqlite_persistent_cookie_store.h

Issue 1016643004: Moves SQLitePersistentCookieStore to net/extras/sqlite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cookies
Patch Set: Review. 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
« no previous file with comments | « net/BUILD.gn ('k') | net/extras/sqlite/sqlite_persistent_cookie_store.cc » ('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 (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 #ifndef NET_EXTRAS_SQLITE_SQLITE_PERSISTENT_COOKIE_STORE_H_
6 #define NET_EXTRAS_SQLITE_SQLITE_PERSISTENT_COOKIE_STORE_H_
6 7
7 #ifndef CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 8 #include <list>
8 #define CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_
9
10 #include <string> 9 #include <string>
10 #include <utility>
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"
15 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
16 #include "content/common/content_export.h"
17 #include "net/cookies/cookie_monster.h" 15 #include "net/cookies/cookie_monster.h"
18 16
19 class Task; 17 class Task;
20 18
21 namespace base { 19 namespace base {
22 class FilePath; 20 class FilePath;
23 class SequencedTaskRunner; 21 class SequencedTaskRunner;
24 } 22 } // namespace base
25 23
26 namespace net { 24 namespace net {
27 class CanonicalCookie; 25 class CanonicalCookie;
28 class CookieCryptoDelegate; 26 class CookieCryptoDelegate;
29 }
30
31 namespace storage {
32 class SpecialStoragePolicy;
33 }
34
35 namespace content {
36 27
37 // Implements the PersistentCookieStore interface in terms of a SQLite database. 28 // Implements the PersistentCookieStore interface in terms of a SQLite database.
38 // For documentation about the actual member functions consult the documentation 29 // For documentation about the actual member functions consult the documentation
39 // of the parent class |net::CookieMonster::PersistentCookieStore|. 30 // of the parent class |CookieMonster::PersistentCookieStore|.
40 // If provided, a |SpecialStoragePolicy| is consulted when the SQLite database 31 class SQLitePersistentCookieStore
41 // is closed to decide which cookies to keep. 32 : public CookieMonster::PersistentCookieStore {
42 class CONTENT_EXPORT SQLitePersistentCookieStore
43 : public net::CookieMonster::PersistentCookieStore {
44 public: 33 public:
34 // Contains the origin and a bool indicating whether or not the
35 // origin is secure.
36 typedef std::pair<std::string, bool> CookieOrigin;
37
45 // All blocking database accesses will be performed on 38 // All blocking database accesses will be performed on
46 // |background_task_runner|, while |client_task_runner| is used to invoke 39 // |background_task_runner|, while |client_task_runner| is used to invoke
47 // callbacks. 40 // callbacks.
48 SQLitePersistentCookieStore( 41 SQLitePersistentCookieStore(
49 const base::FilePath& path, 42 const base::FilePath& path,
50 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, 43 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
51 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 44 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
52 bool restore_old_session_cookies, 45 bool restore_old_session_cookies,
53 storage::SpecialStoragePolicy* special_storage_policy, 46 CookieCryptoDelegate* crypto_delegate);
54 net::CookieCryptoDelegate* crypto_delegate);
55 47
56 // net::CookieMonster::PersistentCookieStore: 48 // Deletes the cookies whose origins match those given in |cookies|.
49 void DeleteAllInList(const std::list<CookieOrigin>& cookies);
50
51 // CookieMonster::PersistentCookieStore:
57 void Load(const LoadedCallback& loaded_callback) override; 52 void Load(const LoadedCallback& loaded_callback) override;
58 void LoadCookiesForKey(const std::string& key, 53 void LoadCookiesForKey(const std::string& key,
59 const LoadedCallback& callback) override; 54 const LoadedCallback& callback) override;
60 void AddCookie(const net::CanonicalCookie& cc) override; 55 void AddCookie(const CanonicalCookie& cc) override;
61 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override; 56 void UpdateCookieAccessTime(const CanonicalCookie& cc) override;
62 void DeleteCookie(const net::CanonicalCookie& cc) override; 57 void DeleteCookie(const CanonicalCookie& cc) override;
63 void SetForceKeepSessionState() override; 58 void SetForceKeepSessionState() override;
64 void Flush(const base::Closure& callback) override; 59 void Flush(const base::Closure& callback) override;
65 60
66 protected: 61 private:
67 ~SQLitePersistentCookieStore() override; 62 ~SQLitePersistentCookieStore() override;
68 63
69 private:
70 class Backend; 64 class Backend;
71 65
72 scoped_refptr<Backend> backend_; 66 scoped_refptr<Backend> backend_;
73 67
74 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); 68 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore);
75 }; 69 };
76 70
77 } // namespace content 71 } // namespace net
78 72
79 #endif // CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 73 #endif // NET_EXTRAS_SQLITE_SQLITE_PERSISTENT_COOKIE_STORE_H_
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/extras/sqlite/sqlite_persistent_cookie_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698