| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 5 #ifndef WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| 6 #define WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 6 #define WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 base::PlatformFile* file_handle) const; | 157 base::PlatformFile* file_handle) const; |
| 158 void SaveIncognitoFileHandle(const string16& vfs_file_path, | 158 void SaveIncognitoFileHandle(const string16& vfs_file_path, |
| 159 const base::PlatformFile& file_handle); | 159 const base::PlatformFile& file_handle); |
| 160 bool CloseIncognitoFileHandle(const string16& vfs_file_path); | 160 bool CloseIncognitoFileHandle(const string16& vfs_file_path); |
| 161 bool HasSavedIncognitoFileHandle(const string16& vfs_file_path) const; | 161 bool HasSavedIncognitoFileHandle(const string16& vfs_file_path) const; |
| 162 | 162 |
| 163 // Shutdown the database tracker, deleting database files if the tracker is | 163 // Shutdown the database tracker, deleting database files if the tracker is |
| 164 // used for an incognito profile or |clear_local_state_on_exit_| is true. | 164 // used for an incognito profile or |clear_local_state_on_exit_| is true. |
| 165 void Shutdown(); | 165 void Shutdown(); |
| 166 void SetClearLocalStateOnExit(bool clear_local_state_on_exit); | 166 void SetClearLocalStateOnExit(bool clear_local_state_on_exit); |
| 167 // Disables the exit-time deletion for all data (also session-only data). |
| 168 void SaveSessionState(); |
| 167 | 169 |
| 168 private: | 170 private: |
| 169 friend class base::RefCountedThreadSafe<DatabaseTracker>; | 171 friend class base::RefCountedThreadSafe<DatabaseTracker>; |
| 170 friend class MockDatabaseTracker; // for testing | 172 friend class MockDatabaseTracker; // for testing |
| 171 | 173 |
| 172 typedef std::map<string16, std::set<string16> > DatabaseSet; | 174 typedef std::map<string16, std::set<string16> > DatabaseSet; |
| 173 typedef std::map<net::OldCompletionCallback*, DatabaseSet> PendingCompletionMa
p; | 175 typedef std::map<net::OldCompletionCallback*, DatabaseSet> PendingCompletionMa
p; |
| 174 typedef std::map<string16, base::PlatformFile> FileHandlesMap; | 176 typedef std::map<string16, base::PlatformFile> FileHandlesMap; |
| 175 typedef std::map<string16, string16> OriginDirectoriesMap; | 177 typedef std::map<string16, string16> OriginDirectoriesMap; |
| 176 | 178 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // invoked upon completion. | 250 // invoked upon completion. |
| 249 void ScheduleDatabasesForDeletion(const DatabaseSet& databases, | 251 void ScheduleDatabasesForDeletion(const DatabaseSet& databases, |
| 250 net::OldCompletionCallback* callback); | 252 net::OldCompletionCallback* callback); |
| 251 | 253 |
| 252 // Returns the directory where all DB files for the given origin are stored. | 254 // Returns the directory where all DB files for the given origin are stored. |
| 253 string16 GetOriginDirectory(const string16& origin_identifier); | 255 string16 GetOriginDirectory(const string16& origin_identifier); |
| 254 | 256 |
| 255 bool is_initialized_; | 257 bool is_initialized_; |
| 256 const bool is_incognito_; | 258 const bool is_incognito_; |
| 257 bool clear_local_state_on_exit_; | 259 bool clear_local_state_on_exit_; |
| 260 bool save_session_state_; |
| 258 bool shutting_down_; | 261 bool shutting_down_; |
| 259 const FilePath profile_path_; | 262 const FilePath profile_path_; |
| 260 const FilePath db_dir_; | 263 const FilePath db_dir_; |
| 261 scoped_ptr<sql::Connection> db_; | 264 scoped_ptr<sql::Connection> db_; |
| 262 scoped_ptr<DatabasesTable> databases_table_; | 265 scoped_ptr<DatabasesTable> databases_table_; |
| 263 scoped_ptr<sql::MetaTable> meta_table_; | 266 scoped_ptr<sql::MetaTable> meta_table_; |
| 264 ObserverList<Observer, true> observers_; | 267 ObserverList<Observer, true> observers_; |
| 265 std::map<string16, CachedOriginInfo> origins_info_map_; | 268 std::map<string16, CachedOriginInfo> origins_info_map_; |
| 266 DatabaseConnections database_connections_; | 269 DatabaseConnections database_connections_; |
| 267 | 270 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 290 // this map to assign directory names that do not reveal this information. | 293 // this map to assign directory names that do not reveal this information. |
| 291 OriginDirectoriesMap incognito_origin_directories_; | 294 OriginDirectoriesMap incognito_origin_directories_; |
| 292 int incognito_origin_directories_generator_; | 295 int incognito_origin_directories_generator_; |
| 293 | 296 |
| 294 FRIEND_TEST_ALL_PREFIXES(DatabaseTracker, TestHelper); | 297 FRIEND_TEST_ALL_PREFIXES(DatabaseTracker, TestHelper); |
| 295 }; | 298 }; |
| 296 | 299 |
| 297 } // namespace webkit_database | 300 } // namespace webkit_database |
| 298 | 301 |
| 299 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 302 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| OLD | NEW |