OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // A sqlite implementation of a cookie monster persistent store. | |
6 | |
7 #ifndef CHROME_COMMON_NET_COOKIE_MONSTER_SQLITE_H__ | |
8 #define CHROME_COMMON_NET_COOKIE_MONSTER_SQLITE_H__ | |
9 | |
10 #include <string> | |
11 #include <vector> | |
12 | |
13 #include "base/ref_counted.h" | |
14 #include "chrome/browser/meta_table_helper.h" | |
15 #include "net/base/cookie_monster.h" | |
16 | |
17 struct sqlite3; | |
18 | |
19 class MessageLoop; | |
20 | |
21 class SQLitePersistentCookieStore | |
22 : public net::CookieMonster::PersistentCookieStore { | |
23 public: | |
24 SQLitePersistentCookieStore(const std::wstring& path, | |
25 MessageLoop* background_loop); | |
26 ~SQLitePersistentCookieStore(); | |
27 | |
28 virtual bool Load(std::vector<net::CookieMonster::KeyedCanonicalCookie>*); | |
29 | |
30 virtual void AddCookie(const std::string&, | |
31 const net::CookieMonster::CanonicalCookie&); | |
32 virtual void UpdateCookieAccessTime( | |
33 const net::CookieMonster::CanonicalCookie&); | |
34 virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie&); | |
35 | |
36 private: | |
37 class Backend; | |
38 | |
39 // Database upgrade statements. | |
40 bool EnsureDatabaseVersion(sqlite3* db); | |
41 | |
42 std::wstring path_; | |
43 scoped_refptr<Backend> backend_; | |
44 | |
45 // Background MessageLoop on which to access the backend_; | |
46 MessageLoop* background_loop_; | |
47 | |
48 MetaTableHelper meta_table_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); | |
51 }; | |
52 | |
53 #endif // CHROME_COMMON_NET_COOKIE_MONSTER_SQLITE_H__ | |
OLD | NEW |