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

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: git cl format net 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.
Avi (use Gerrit) 2015/05/14 19:11:31 Is this comment useful given the one on the class
rohitrao (ping after 24h) 2015/05/14 20:32:10 Done.
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 "content/common/content_export.h"
17 #include "net/cookies/cookie_monster.h"
18 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
19
20 class Task;
21
22 namespace base {
23 class FilePath;
24 class SequencedTaskRunner;
25 } // namespace base
26
27 namespace net {
28 class CanonicalCookie;
29 class CookieCryptoDelegate;
30 } // namespace net
31
32 namespace storage {
33 class SpecialStoragePolicy;
34 } // namespace storage
35
36 namespace content {
37
38 // Implements a PersistentCookieStore that deletes session cookies on
39 // shutdown. For documentation about the actual member functions consult the
40 // parent class |net::CookieMonster::PersistentCookieStore|. If provided, a
41 // |SpecialStoragePolicy| is consulted when the SQLite database is closed to
42 // decide which cookies to keep.
43 class CONTENT_EXPORT QuotaPolicyCookieStore
44 : public net::CookieMonster::PersistentCookieStore {
45 public:
46 // Wraps the passed-in |cookie_store|.
47 QuotaPolicyCookieStore(
48 const scoped_refptr<net::SQLitePersistentCookieStore>& cookie_store,
49 storage::SpecialStoragePolicy* special_storage_policy);
50
51 // net::CookieMonster::PersistentCookieStore:
52 void Load(const LoadedCallback& loaded_callback) override;
53 void LoadCookiesForKey(const std::string& key,
54 const LoadedCallback& callback) override;
55 void AddCookie(const net::CanonicalCookie& cc) override;
56 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override;
57 void DeleteCookie(const net::CanonicalCookie& cc) override;
58 void SetForceKeepSessionState() override;
59 void Flush(const base::Closure& callback) override;
60
61 private:
62 typedef std::map<net::SQLitePersistentCookieStore::CookieOrigin, size_t>
63 CookiesPerOriginMap;
64
65 ~QuotaPolicyCookieStore() override;
66
67 // Called after cookies are loaded from the database. Calls |loaded_callback|
68 // when done.
69 void OnLoad(const LoadedCallback& loaded_callback,
70 const std::vector<net::CanonicalCookie*>& cookies);
71
72 // Map of (domain keys(eTLD+1), is secure cookie) to number of cookies in the
73 // database.
74 CookiesPerOriginMap cookies_per_origin_;
75
76 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
77 scoped_refptr<net::SQLitePersistentCookieStore> persistent_store_;
78
79 DISALLOW_COPY_AND_ASSIGN(QuotaPolicyCookieStore);
80 };
81
82 } // namespace content
83
84 #endif // CONTENT_BROWSER_NET_QUOTA_POLICY_COOKIE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698