| Index: components/history/core/browser/download_database.cc
|
| diff --git a/components/history/core/browser/download_database.cc b/components/history/core/browser/download_database.cc
|
| index 9b7d4f76d54e285ba5fc0939642a00913c3d64e4..01bb312ad7ca32e0d138da1e1012143093ce749f 100644
|
| --- a/components/history/core/browser/download_database.cc
|
| +++ b/components/history/core/browser/download_database.cc
|
| @@ -277,6 +277,10 @@ bool DownloadDatabase::MigrateDownloadLastAccessTime() {
|
| return EnsureColumnExists("last_access_time", "INTEGER NOT NULL DEFAULT 0");
|
| }
|
|
|
| +bool DownloadDatabase::MigrateDownloadTransient() {
|
| + return EnsureColumnExists("transient", "INTEGER NOT NULL DEFAULT 0");
|
| +}
|
| +
|
| bool DownloadDatabase::InitDownloadTable() {
|
| const char kSchema[] =
|
| "CREATE TABLE downloads ("
|
| @@ -295,6 +299,7 @@ bool DownloadDatabase::InitDownloadTable() {
|
| "opened INTEGER NOT NULL," // 1 if it has ever been opened
|
| // else 0
|
| "last_access_time INTEGER NOT NULL," // The last time it was accessed.
|
| + "transient INTEGER NOT NULL," // 1 if it is transient, else 0.
|
| "referrer VARCHAR NOT NULL," // HTTP Referrer
|
| "site_url VARCHAR NOT NULL," // Site URL for initiating site
|
| // instance.
|
| @@ -386,9 +391,9 @@ void DownloadDatabase::QueryDownloads(std::vector<DownloadRow>* results) {
|
| "SELECT id, guid, current_path, target_path, mime_type, "
|
| "original_mime_type, start_time, received_bytes, total_bytes, state, "
|
| "danger_type, interrupt_reason, hash, end_time, opened, "
|
| - "last_access_time, referrer, site_url, tab_url, tab_referrer_url, "
|
| - "http_method, by_ext_id, by_ext_name, etag, last_modified "
|
| - "FROM downloads ORDER BY start_time"));
|
| + "last_access_time, transient, referrer, site_url, tab_url, "
|
| + "tab_referrer_url, http_method, by_ext_id, by_ext_name, etag, "
|
| + "last_modified FROM downloads ORDER BY start_time"));
|
|
|
| while (statement_main.Step()) {
|
| std::unique_ptr<DownloadRow> info(new DownloadRow());
|
| @@ -422,6 +427,7 @@ void DownloadDatabase::QueryDownloads(std::vector<DownloadRow>* results) {
|
| info->opened = statement_main.ColumnInt(column++) != 0;
|
| info->last_access_time =
|
| base::Time::FromInternalValue(statement_main.ColumnInt64(column++));
|
| + info->transient = statement_main.ColumnInt(column++) != 0;
|
| info->referrer_url = GURL(statement_main.ColumnString(column++));
|
| info->site_url = GURL(statement_main.ColumnString(column++));
|
| info->tab_url = GURL(statement_main.ColumnString(column++));
|
| @@ -539,8 +545,8 @@ bool DownloadDatabase::UpdateDownload(const DownloadRow& data) {
|
| "mime_type=?, original_mime_type=?, "
|
| "received_bytes=?, state=?, "
|
| "danger_type=?, interrupt_reason=?, hash=?, end_time=?, total_bytes=?, "
|
| - "opened=?, last_access_time=?, by_ext_id=?, by_ext_name=?, etag=?, "
|
| - "last_modified=? WHERE id=?"));
|
| + "opened=?, last_access_time=?, transient=?, by_ext_id=?, by_ext_name=?, "
|
| + "etag=?, last_modified=? WHERE id=?"));
|
| int column = 0;
|
| BindFilePath(statement, data.current_path, column++);
|
| BindFilePath(statement, data.target_path, column++);
|
| @@ -556,6 +562,7 @@ bool DownloadDatabase::UpdateDownload(const DownloadRow& data) {
|
| statement.BindInt64(column++, data.total_bytes);
|
| statement.BindInt(column++, (data.opened ? 1 : 0));
|
| statement.BindInt64(column++, data.last_access_time.ToInternalValue());
|
| + statement.BindInt(column++, (data.transient ? 1 : 0));
|
| statement.BindString(column++, data.by_ext_id);
|
| statement.BindString(column++, data.by_ext_name);
|
| statement.BindString(column++, data.etag);
|
| @@ -614,11 +621,12 @@ bool DownloadDatabase::CreateDownload(const DownloadRow& info) {
|
| "(id, guid, current_path, target_path, mime_type, original_mime_type, "
|
| " start_time, received_bytes, total_bytes, state, danger_type, "
|
| " interrupt_reason, hash, end_time, opened, last_access_time, "
|
| - " referrer, site_url, tab_url, tab_referrer_url, http_method, "
|
| + "transient, referrer, site_url, tab_url, tab_referrer_url, "
|
| + "http_method, "
|
| " by_ext_id, by_ext_name, etag, last_modified) "
|
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
| " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
| - " ?, ?, ?, ?, ?)"));
|
| + " ?, ?, ?, ?, ?, ?)"));
|
|
|
| int column = 0;
|
| statement_insert.BindInt(column++, DownloadIdToInt(info.id));
|
| @@ -640,6 +648,7 @@ bool DownloadDatabase::CreateDownload(const DownloadRow& info) {
|
| statement_insert.BindInt(column++, info.opened ? 1 : 0);
|
| statement_insert.BindInt64(column++,
|
| info.last_access_time.ToInternalValue());
|
| + statement_insert.BindInt(column++, info.transient ? 1 : 0);
|
| statement_insert.BindString(column++, info.referrer_url.spec());
|
| statement_insert.BindString(column++, info.site_url.spec());
|
| statement_insert.BindString(column++, info.tab_url.spec());
|
|
|