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 3 // found in the LICENSE file. 4 5 // A sqlite implementation of a cookie monster persistent store. 6 7 #ifndef CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 8 #define CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 9 #pragma once 10 11 #include <string> 12 #include <vector> 13 14 #ifdef ANDROID 15 #include "base/base_api.h" 16 #endif 17 #include "base/memory/ref_counted.h" 18 #include "net/base/cookie_monster.h" 19 20 class FilePath; 21 22 // Implements the PersistentCookieStore interface in terms of a SQLite database. 23 // For documentation about the actual member functions consult the documentation 24 // of the parent class |net::CookieMonster::PersistentCookieStore|. 25 class 26 #ifdef ANDROID 27 BASE_API 28 #endif 29 SQLitePersistentCookieStore 30 : public net::CookieMonster::PersistentCookieStore { 31 public: 32 explicit SQLitePersistentCookieStore(const FilePath& path); 33 virtual ~SQLitePersistentCookieStore(); 34 35 virtual bool Load(std::vector<net::CookieMonster::CanonicalCookie*>* cookies); 36 37 virtual void AddCookie(const net::CookieMonster::CanonicalCookie& cc); 38 virtual void UpdateCookieAccessTime( 39 const net::CookieMonster::CanonicalCookie& cc); 40 virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc); 41 42 virtual void SetClearLocalStateOnExit(bool clear_local_state); 43 44 virtual void Flush(Task* completion_task); 45 46 #if defined(ANDROID) 47 int GetCookieCount(); 48 #endif 49 50 private: 51 class Backend; 52 53 scoped_refptr<Backend> backend_; 54 55 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); 56 }; 57 58 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 59