Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: chrome/browser/net/sqlite_persistent_cookie_store.h

Issue 5430004: Refactored cookies persistent store clean-up on shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit test and moved flag to the persistence store itself. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 SQLite database.
jochen (gone - plz use gerrit) 2010/12/02 15:09:51 ... in terms of a ... or ... using a ...
pastarmovj 2010/12/02 16:29:07 Done.
26 // For documentation of the actually member functions consult the documentation
jochen (gone - plz use gerrit) 2010/12/02 15:09:51 documentation about
pastarmovj 2010/12/02 16:29:07 Done.
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) {
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.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698