| 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 CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 7 #ifndef CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| 8 #define CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 8 #define CHROME_BROWSER_NET_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 "net/cookies/cookie_monster.h" | 16 #include "net/cookies/cookie_monster.h" |
| 17 | 17 |
| 18 class ClearOnExitPolicy; | 18 class ClearOnExitPolicy; |
| 19 class FilePath; | 19 class FilePath; |
| 20 class Task; | 20 class Task; |
| 21 | 21 |
| 22 namespace net { |
| 23 class CanonicalCookie; |
| 24 } |
| 25 |
| 22 // Implements the PersistentCookieStore interface in terms of a SQLite database. | 26 // Implements the PersistentCookieStore interface in terms of a SQLite database. |
| 23 // For documentation about the actual member functions consult the documentation | 27 // For documentation about the actual member functions consult the documentation |
| 24 // of the parent class |net::CookieMonster::PersistentCookieStore|. | 28 // of the parent class |net::CookieMonster::PersistentCookieStore|. |
| 25 // If provided, a |ClearOnExitPolicy| is consulted when the SQLite database is | 29 // If provided, a |ClearOnExitPolicy| is consulted when the SQLite database is |
| 26 // closed to decide which cookies to keep. | 30 // closed to decide which cookies to keep. |
| 27 class SQLitePersistentCookieStore | 31 class SQLitePersistentCookieStore |
| 28 : public net::CookieMonster::PersistentCookieStore { | 32 : public net::CookieMonster::PersistentCookieStore { |
| 29 public: | 33 public: |
| 30 // If non-NULL, SQLitePersistentCookieStore will keep a scoped_refptr to the | 34 // If non-NULL, SQLitePersistentCookieStore will keep a scoped_refptr to the |
| 31 // |clear_on_exit_policy| throughout its lifetime. | 35 // |clear_on_exit_policy| throughout its lifetime. |
| 32 SQLitePersistentCookieStore( | 36 SQLitePersistentCookieStore( |
| 33 const FilePath& path, | 37 const FilePath& path, |
| 34 bool restore_old_session_cookies, | 38 bool restore_old_session_cookies, |
| 35 ClearOnExitPolicy* clear_on_exit_policy); | 39 ClearOnExitPolicy* clear_on_exit_policy); |
| 36 | 40 |
| 37 // net::CookieMonster::PersistentCookieStore: | 41 // net::CookieMonster::PersistentCookieStore: |
| 38 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; | 42 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; |
| 39 virtual void LoadCookiesForKey(const std::string& key, | 43 virtual void LoadCookiesForKey(const std::string& key, |
| 40 const LoadedCallback& callback) OVERRIDE; | 44 const LoadedCallback& callback) OVERRIDE; |
| 41 virtual void AddCookie( | 45 virtual void AddCookie(const net::CanonicalCookie& cc) OVERRIDE; |
| 42 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 46 virtual void UpdateCookieAccessTime(const net::CanonicalCookie& cc) OVERRIDE; |
| 43 virtual void UpdateCookieAccessTime( | 47 virtual void DeleteCookie(const net::CanonicalCookie& cc) OVERRIDE; |
| 44 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | |
| 45 virtual void DeleteCookie( | |
| 46 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | |
| 47 virtual void SetForceKeepSessionState() OVERRIDE; | 48 virtual void SetForceKeepSessionState() OVERRIDE; |
| 48 virtual void Flush(const base::Closure& callback) OVERRIDE; | 49 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 virtual ~SQLitePersistentCookieStore(); | 52 virtual ~SQLitePersistentCookieStore(); |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 class Backend; | 55 class Backend; |
| 55 | 56 |
| 56 scoped_refptr<Backend> backend_; | 57 scoped_refptr<Backend> backend_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | 59 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 62 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| OLD | NEW |