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 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ |
6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ | 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // The indexed db directory. | 27 // The indexed db directory. |
28 static const FilePath::CharType kIndexedDBDirectory[]; | 28 static const FilePath::CharType kIndexedDBDirectory[]; |
29 | 29 |
30 // The indexed db file extension. | 30 // The indexed db file extension. |
31 static const FilePath::CharType kIndexedDBExtension[]; | 31 static const FilePath::CharType kIndexedDBExtension[]; |
32 | 32 |
33 // Get the file name of the indexed db file for the given origin. | 33 // Get the file name of the indexed db file for the given origin. |
34 FilePath GetIndexedDBFilePath(const string16& origin_id) const; | 34 FilePath GetIndexedDBFilePath(const string16& origin_id) const; |
35 | 35 |
36 // Deletes all idb files except for those on the url scheme | 36 void set_clear_local_state_on_exit(bool clear_local_state) { |
37 // |url_scheme_to_be_skipped|. | 37 clear_local_state_on_exit_ = clear_local_state; |
38 static void ClearLocalState(const FilePath& profile_path, | 38 } |
39 const char* url_scheme_to_be_skipped); | |
40 | 39 |
41 // Deletes a single indexed db file. | 40 // Deletes a single indexed db file. |
42 void DeleteIndexedDBFile(const FilePath& file_path); | 41 void DeleteIndexedDBFile(const FilePath& file_path); |
43 | 42 |
44 // Deletes all indexed db files for the given origin. | 43 // Deletes all indexed db files for the given origin. |
45 void DeleteIndexedDBForOrigin(const string16& origin_id); | 44 void DeleteIndexedDBForOrigin(const string16& origin_id); |
46 | 45 |
| 46 #ifdef UNIT_TEST |
| 47 // For unit tests allow to override the |data_path_|. |
| 48 void set_data_path(const FilePath& data_path) { data_path_ = data_path; } |
| 49 #endif |
| 50 |
47 private: | 51 private: |
48 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; | 52 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; |
49 | 53 |
50 // We're owned by this WebKit context. | 54 // Path where the indexed db data is stored |
51 WebKitContext* webkit_context_; | 55 FilePath data_path_; |
| 56 |
| 57 // True if the destructor should delete its files. |
| 58 bool clear_local_state_on_exit_; |
52 | 59 |
53 DISALLOW_COPY_AND_ASSIGN(IndexedDBContext); | 60 DISALLOW_COPY_AND_ASSIGN(IndexedDBContext); |
54 }; | 61 }; |
55 | 62 |
56 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ | 63 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ |
OLD | NEW |