| 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "net/cookies/cookie_monster.h" | 17 #include "net/cookies/cookie_monster.h" |
| 18 | 18 |
| 19 class FilePath; | 19 class FilePath; |
| 20 class Task; | 20 class Task; |
| 21 | 21 |
| 22 // Implements the PersistentCookieStore interface in terms of a SQLite database. | 22 // Implements the PersistentCookieStore interface in terms of a SQLite database. |
| 23 // For documentation about the actual member functions consult the documentation | 23 // For documentation about the actual member functions consult the documentation |
| 24 // of the parent class |net::CookieMonster::PersistentCookieStore|. | 24 // of the parent class |net::CookieMonster::PersistentCookieStore|. |
| 25 class SQLitePersistentCookieStore | 25 class SQLitePersistentCookieStore |
| 26 : public net::CookieMonster::PersistentCookieStore { | 26 : public net::CookieMonster::PersistentCookieStore { |
| 27 public: | 27 public: |
| 28 SQLitePersistentCookieStore(const FilePath& path, | 28 SQLitePersistentCookieStore(const FilePath& path, |
| 29 bool restore_old_session_cookies); | 29 bool restore_old_session_cookies); |
| 30 virtual ~SQLitePersistentCookieStore(); | |
| 31 | 30 |
| 31 // net::CookieMonster::PersistentCookieStore: |
| 32 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; | 32 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; |
| 33 | |
| 34 virtual void LoadCookiesForKey(const std::string& key, | 33 virtual void LoadCookiesForKey(const std::string& key, |
| 35 const LoadedCallback& callback) OVERRIDE; | 34 const LoadedCallback& callback) OVERRIDE; |
| 36 | |
| 37 virtual void AddCookie( | 35 virtual void AddCookie( |
| 38 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 36 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; |
| 39 | |
| 40 virtual void UpdateCookieAccessTime( | 37 virtual void UpdateCookieAccessTime( |
| 41 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 38 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; |
| 42 | |
| 43 virtual void DeleteCookie( | 39 virtual void DeleteCookie( |
| 44 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 40 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; |
| 41 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; |
| 42 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 45 | 43 |
| 46 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; | 44 protected: |
| 47 | 45 virtual ~SQLitePersistentCookieStore(); |
| 48 virtual void Flush(const base::Closure& callback) OVERRIDE; | |
| 49 | 46 |
| 50 private: | 47 private: |
| 51 class Backend; | 48 class Backend; |
| 52 | 49 |
| 53 scoped_refptr<Backend> backend_; | 50 scoped_refptr<Backend> backend_; |
| 54 | 51 |
| 55 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | 52 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); |
| 56 }; | 53 }; |
| 57 | 54 |
| 58 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 55 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| OLD | NEW |