// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // A sqlite implementation of a cookie monster persistent store. #ifndef CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ #define CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ #include #include #include "app/sql/connection.h" #include "app/sql/meta_table.h" #include "base/file_path.h" #include "base/ref_counted.h" #include "net/base/cookie_monster.h" class FilePath; class MessageLoop; class SQLitePersistentCookieStore : public net::CookieMonster::PersistentCookieStore { public: SQLitePersistentCookieStore(const FilePath& path, MessageLoop* background_loop); ~SQLitePersistentCookieStore(); virtual bool Load(std::vector*); virtual void AddCookie(const std::string&, const net::CookieMonster::CanonicalCookie&); virtual void UpdateCookieAccessTime( const net::CookieMonster::CanonicalCookie&); virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie&); private: class Backend; // Database upgrade statements. bool EnsureDatabaseVersion(sql::Connection* db); FilePath path_; scoped_refptr backend_; // Background MessageLoop on which to access the backend_; MessageLoop* background_loop_; sql::MetaTable meta_table_; DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); }; #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_