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

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: Use WeakPtr. 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
(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.
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/weak_ptr.h"
17 #include "content/common/content_export.h"
18 #include "net/cookies/cookie_monster.h"
19 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
20
21 class Task;
22
23 namespace base {
24 class FilePath;
25 class SequencedTaskRunner;
26 } // namespace base
27
28 namespace net {
29 class CanonicalCookie;
30 class CookieCryptoDelegate;
31 } // namespace net
32
33 namespace storage {
34 class SpecialStoragePolicy;
35 } // namespace storage
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 base::SupportsWeakPtr<QuotaPolicyCookieStore> {
Ryan Sleevi 2015/05/14 01:19:35 Future note: Never inherit from this ;) WeakPtr's
rohitrao (ping after 24h) 2015/05/14 15:48:34 Acknowledged.
47 public:
48 // Wraps the passed-in |cookie_store|.
49 QuotaPolicyCookieStore(
50 const scoped_refptr<net::SQLitePersistentCookieStore>& cookie_store,
51 storage::SpecialStoragePolicy* special_storage_policy);
52
53 // net::CookieMonster::PersistentCookieStore:
54 void Load(const LoadedCallback& loaded_callback) override;
55 void LoadCookiesForKey(const std::string& key,
56 const LoadedCallback& callback) override;
57 void AddCookie(const net::CanonicalCookie& cc) override;
58 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override;
59 void DeleteCookie(const net::CanonicalCookie& cc) override;
60 void SetForceKeepSessionState() override;
61 void Flush(const base::Closure& callback) override;
62
63 private:
64 typedef std::map<net::SQLitePersistentCookieStore::CookieOrigin, size_t>
65 CookiesPerOriginMap;
66
67 ~QuotaPolicyCookieStore() override;
68
69 // Called after cookies are loaded from the database. Calls |loaded_callback|
70 // when done.
71 void OnLoad(const LoadedCallback& loaded_callback,
72 const std::vector<net::CanonicalCookie*>& cookies);
73
74 // Map of (domain keys(eTLD+1), is secure cookie) to number of cookies in the
75 // database.
76 CookiesPerOriginMap cookies_per_origin_;
77
78 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
79 scoped_refptr<net::SQLitePersistentCookieStore> persistent_store_;
80
81 DISALLOW_COPY_AND_ASSIGN(QuotaPolicyCookieStore);
82 };
83
84 } // namespace content
85
86 #endif // CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698