OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/sql/meta_table.h" | 14 #include "app/sql/meta_table.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
17 #include "net/base/cookie_monster.h" | 17 #include "net/base/cookie_monster.h" |
18 | 18 |
19 namespace sql { | 19 namespace sql { |
20 class Connection; | 20 class Connection; |
21 } | 21 } |
22 | 22 |
23 class FilePath; | 23 class FilePath; |
24 | 24 |
25 // Implements the PersistentCookieStore interface in terms of a SQLite database. | |
26 // For documentation about the actual member functions consult the documentation | |
27 // of the parent class |net::CookieMonster::PersistentCookieStore|. | |
25 class SQLitePersistentCookieStore | 28 class SQLitePersistentCookieStore |
26 : public net::CookieMonster::PersistentCookieStore { | 29 : public net::CookieMonster::PersistentCookieStore { |
27 public: | 30 public: |
28 explicit SQLitePersistentCookieStore(const FilePath& path); | 31 explicit SQLitePersistentCookieStore(const FilePath& path); |
29 virtual ~SQLitePersistentCookieStore(); | 32 virtual ~SQLitePersistentCookieStore(); |
30 | 33 |
31 virtual bool Load(std::vector<net::CookieMonster::CanonicalCookie*>*); | 34 virtual bool Load(std::vector<net::CookieMonster::CanonicalCookie*>* cookies); |
32 | 35 |
33 virtual void AddCookie(const net::CookieMonster::CanonicalCookie&); | 36 virtual void AddCookie(const net::CookieMonster::CanonicalCookie& cc); |
34 virtual void UpdateCookieAccessTime( | 37 virtual void UpdateCookieAccessTime( |
35 const net::CookieMonster::CanonicalCookie&); | 38 const net::CookieMonster::CanonicalCookie& cc); |
36 virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie&); | 39 virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc); |
37 | 40 |
38 static void ClearLocalState(const FilePath& path); | 41 void SetClearLocalStateOnExit(bool clear_local_state) { |
jochen (gone - plz use gerrit)
2010/12/02 16:48:44
virtual
pastarmovj
2010/12/03 16:43:02
Done.
| |
42 clear_local_state_on_exit_ = clear_local_state; | |
43 } | |
39 | 44 |
40 private: | 45 private: |
41 class Backend; | 46 class Backend; |
42 | 47 |
43 // Database upgrade statements. | 48 // Database upgrade statements. |
44 bool EnsureDatabaseVersion(sql::Connection* db); | 49 bool EnsureDatabaseVersion(sql::Connection* db); |
45 | 50 |
46 FilePath path_; | 51 FilePath path_; |
47 scoped_refptr<Backend> backend_; | 52 scoped_refptr<Backend> backend_; |
48 | 53 |
54 // If true the persistent store should be deleted upon destruction. | |
jochen (gone - plz use gerrit)
2010/12/02 16:48:44
True if ..
pastarmovj
2010/12/03 16:43:02
Done.
| |
55 bool clear_local_state_on_exit_; | |
56 | |
49 sql::MetaTable meta_table_; | 57 sql::MetaTable meta_table_; |
50 | 58 |
51 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | 59 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); |
52 }; | 60 }; |
53 | 61 |
54 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ | 62 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ |
OLD | NEW |