Index: chrome/browser/history/download_database.h |
diff --git a/chrome/browser/history/download_database.h b/chrome/browser/history/download_database.h |
index 1d5d3fde9de3c1d361aeb0e86b45b3d12061ab2f..ff86eb13270e50106936e88883dd27de4a6377e5 100644 |
--- a/chrome/browser/history/download_database.h |
+++ b/chrome/browser/history/download_database.h |
@@ -34,7 +34,8 @@ class DownloadDatabase { |
void QueryDownloads(std::vector<DownloadPersistentStoreInfo>* results); |
// Update the state of one download. Returns true if successful. |
- bool UpdateDownload(int64 received_bytes, int32 state, DownloadID db_handle); |
+ bool UpdateDownload(int64 received_bytes, int32 state, |
+ const base::Time& end_time, DownloadID db_handle); |
// Update the path of one download. Returns true if successful. |
bool UpdateDownloadPath(const FilePath& path, DownloadID db_handle); |
@@ -57,6 +58,9 @@ class DownloadDatabase { |
// all downloads that are in progress or are waiting to be cancelled. |
void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); |
+ // Set the |opened| flag to true. |
+ void MarkDownloadOpened(DownloadID db_handle); |
+ |
protected: |
// Returns the database for the functions in this interface. |
virtual sql::Connection& GetDB() = 0; |
@@ -68,6 +72,25 @@ class DownloadDatabase { |
// would re-initialize it. |
bool DropDownloadTable(); |
+ bool MaybeUpgradeDownloadsSchema(); |
+ |
+ bool CreateDownloadsTable(); |
+ |
+ enum DownloadsSchemaVersion { |
+ DOWNLOADS_SCHEMA_VERSION_UNINITIALIZED = -1, |
+ DOWNLOADS_SCHEMA_VERSION_BASE = 0, |
+ DOWNLOADS_SCHEMA_VERSION_OPENED = 1, |
+ // Add new schema versions here with explicit numbers, update kCurrent, and |
+ // support your new version in CreateDownloadsTable, |
+ // MaybeUpgradeDownloadsSchema, and QueryDownloads. |
+ }; |
+ static const DownloadsSchemaVersion kCurrentDownloadsSchemaVersion = |
+ DOWNLOADS_SCHEMA_VERSION_OPENED; |
+ |
+ DownloadsSchemaVersion downloads_schema_version() const { |
+ return schema_version_; |
+ } |
+ |
private: |
// TODO(rdsmith): Remove after http://crbug.com/96627 has been resolved. |
std::set<int64> returned_ids_; |
@@ -76,6 +99,7 @@ class DownloadDatabase { |
int next_id_; |
sql::MetaTable meta_table_; |
+ DownloadsSchemaVersion schema_version_; |
DISALLOW_COPY_AND_ASSIGN(DownloadDatabase); |
}; |