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