| 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 namespace quota { |
| 23 class SpecialStoragePolicy; |
| 24 } // namespace quota |
| 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 class SQLitePersistentCookieStore | 29 class SQLitePersistentCookieStore |
| 26 : public net::CookieMonster::PersistentCookieStore { | 30 : public net::CookieMonster::PersistentCookieStore { |
| 27 public: | 31 public: |
| 28 SQLitePersistentCookieStore(const FilePath& path, | 32 SQLitePersistentCookieStore( |
| 29 bool restore_old_session_cookies); | 33 const FilePath& path, |
| 34 bool restore_old_session_cookies, |
| 35 quota::SpecialStoragePolicy* special_storage_policy); |
| 30 | 36 |
| 31 // net::CookieMonster::PersistentCookieStore: | 37 // net::CookieMonster::PersistentCookieStore: |
| 32 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; | 38 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; |
| 33 virtual void LoadCookiesForKey(const std::string& key, | 39 virtual void LoadCookiesForKey(const std::string& key, |
| 34 const LoadedCallback& callback) OVERRIDE; | 40 const LoadedCallback& callback) OVERRIDE; |
| 35 virtual void AddCookie( | 41 virtual void AddCookie( |
| 36 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 42 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; |
| 37 virtual void UpdateCookieAccessTime( | 43 virtual void UpdateCookieAccessTime( |
| 38 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 44 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; |
| 39 virtual void DeleteCookie( | 45 virtual void DeleteCookie( |
| 40 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; | 46 const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; |
| 41 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; | 47 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; |
| 42 virtual void Flush(const base::Closure& callback) OVERRIDE; | 48 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 43 | 49 |
| 44 protected: | 50 protected: |
| 45 virtual ~SQLitePersistentCookieStore(); | 51 virtual ~SQLitePersistentCookieStore(); |
| 46 | 52 |
| 47 private: | 53 private: |
| 48 class Backend; | 54 class Backend; |
| 49 | 55 |
| 50 scoped_refptr<Backend> backend_; | 56 scoped_refptr<Backend> backend_; |
| 51 | 57 |
| 52 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | 58 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 61 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
| OLD | NEW |