Chromium Code Reviews| 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 CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| 8 #define CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 8 #define CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 class CanonicalCookie; | 27 class CanonicalCookie; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace quota { | 30 namespace quota { |
| 31 class SpecialStoragePolicy; | 31 class SpecialStoragePolicy; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace content { | 34 namespace content { |
| 35 class CookieCryptoDelegate; | |
| 35 | 36 |
| 36 // Implements the PersistentCookieStore interface in terms of a SQLite database. | 37 // Implements the PersistentCookieStore interface in terms of a SQLite database. |
| 37 // For documentation about the actual member functions consult the documentation | 38 // For documentation about the actual member functions consult the documentation |
| 38 // of the parent class |net::CookieMonster::PersistentCookieStore|. | 39 // of the parent class |net::CookieMonster::PersistentCookieStore|. |
| 39 // If provided, a |SpecialStoragePolicy| is consulted when the SQLite database | 40 // If provided, a |SpecialStoragePolicy| is consulted when the SQLite database |
| 40 // is closed to decide which cookies to keep. | 41 // is closed to decide which cookies to keep. |
| 41 class CONTENT_EXPORT SQLitePersistentCookieStore | 42 class CONTENT_EXPORT SQLitePersistentCookieStore |
| 42 : public net::CookieMonster::PersistentCookieStore { | 43 : public net::CookieMonster::PersistentCookieStore { |
| 43 public: | 44 public: |
| 44 // All blocking database accesses will be performed on | 45 // All blocking database accesses will be performed on |
| 45 // |background_task_runner|, while |client_task_runner| is used to invoke | 46 // |background_task_runner|, while |client_task_runner| is used to invoke |
| 46 // callbacks. | 47 // callbacks. This object takes ownership of the |crypto_delegate|. |
| 47 SQLitePersistentCookieStore( | 48 SQLitePersistentCookieStore( |
| 48 const base::FilePath& path, | 49 const base::FilePath& path, |
| 49 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, | 50 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, |
| 50 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, | 51 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
| 51 bool restore_old_session_cookies, | 52 bool restore_old_session_cookies, |
| 52 quota::SpecialStoragePolicy* special_storage_policy); | 53 quota::SpecialStoragePolicy* special_storage_policy, |
| 54 CookieCryptoDelegate* crypto_delegate); | |
|
erikwright (departed)
2013/10/07 20:39:25
make this a scoped_ptr. That is the modern way to
bcwhite
2013/10/08 16:10:25
Could you provide an example? A search for "takes
erikwright (departed)
2013/10/08 16:50:56
Precisely. With the new model, comments are no lon
bcwhite
2013/10/08 18:23:36
I've tried this and it doesn't work well. You can
erikwright (departed)
2013/10/08 18:41:52
Yes you can, and we do in much code:
scoped_ptr<X
bcwhite
2013/10/08 20:18:09
That means creating a scoped_ptr<Y> in the caller
erikwright (departed)
2013/10/08 20:24:35
No. It will look like this:
new SQLitePersistentC
bcwhite
2013/10/08 21:08:39
Done.
| |
| 53 | 55 |
| 54 // net::CookieMonster::PersistentCookieStore: | 56 // net::CookieMonster::PersistentCookieStore: |
| 55 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; | 57 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; |
| 56 virtual void LoadCookiesForKey(const std::string& key, | 58 virtual void LoadCookiesForKey(const std::string& key, |
| 57 const LoadedCallback& callback) OVERRIDE; | 59 const LoadedCallback& callback) OVERRIDE; |
| 58 virtual void AddCookie(const net::CanonicalCookie& cc) OVERRIDE; | 60 virtual void AddCookie(const net::CanonicalCookie& cc) OVERRIDE; |
| 59 virtual void UpdateCookieAccessTime(const net::CanonicalCookie& cc) OVERRIDE; | 61 virtual void UpdateCookieAccessTime(const net::CanonicalCookie& cc) OVERRIDE; |
| 60 virtual void DeleteCookie(const net::CanonicalCookie& cc) OVERRIDE; | 62 virtual void DeleteCookie(const net::CanonicalCookie& cc) OVERRIDE; |
| 61 virtual void SetForceKeepSessionState() OVERRIDE; | 63 virtual void SetForceKeepSessionState() OVERRIDE; |
| 62 virtual void Flush(const base::Closure& callback) OVERRIDE; | 64 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 63 | 65 |
| 64 protected: | 66 protected: |
| 65 virtual ~SQLitePersistentCookieStore(); | 67 virtual ~SQLitePersistentCookieStore(); |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 class Backend; | 70 class Backend; |
| 69 | 71 |
| 70 scoped_refptr<Backend> backend_; | 72 scoped_refptr<Backend> backend_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | 74 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace content | 77 } // namespace content |
| 76 | 78 |
| 77 #endif // CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 79 #endif // CONTENT_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| OLD | NEW |