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 fb6b9efb68fffe5af1679601fc435c9d6ad22429..e4d294e0ef1c352fe8541c3f5affc7592243ae51 100644 |
--- a/components/history/core/browser/download_database.cc |
+++ b/components/history/core/browser/download_database.cc |
@@ -255,6 +255,10 @@ bool DownloadDatabase::MigrateDownloadTabUrl() { |
EnsureColumnExists("tab_referrer_url", "VARCHAR NOT NULL DEFAULT ''"); |
} |
+bool DownloadDatabase::MigrateDownloadSiteInstanceUrl() { |
+ return EnsureColumnExists("site_url", "VARCHAR NOT NULL DEFAULT ''"); |
+} |
+ |
bool DownloadDatabase::InitDownloadTable() { |
const char kSchema[] = |
"CREATE TABLE downloads (" |
@@ -273,6 +277,8 @@ bool DownloadDatabase::InitDownloadTable() { |
"opened INTEGER NOT NULL," // 1 if it has ever been opened |
// else 0 |
"referrer VARCHAR NOT NULL," // HTTP Referrer |
+ "site_url VARCHAR NOT NULL," // Site URL for initiating site |
+ // instance. |
"tab_url VARCHAR NOT NULL," // Tab URL for initiator. |
"tab_referrer_url VARCHAR NOT NULL," // Tag referrer URL for initiator. |
"http_method VARCHAR NOT NULL," // HTTP method. |
@@ -344,8 +350,8 @@ 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, referrer, " |
- "tab_url, tab_referrer_url, http_method, by_ext_id, by_ext_name, etag, " |
- "last_modified FROM downloads ORDER BY start_time")); |
+ "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()); |
@@ -378,6 +384,7 @@ void DownloadDatabase::QueryDownloads(std::vector<DownloadRow>* results) { |
base::Time::FromInternalValue(statement_main.ColumnInt64(column++)); |
info->opened = 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++)); |
info->tab_referrer_url = GURL(statement_main.ColumnString(column++)); |
info->http_method = statement_main.ColumnString(column++); |
@@ -552,12 +559,12 @@ bool DownloadDatabase::CreateDownload(const DownloadRow& info) { |
"INSERT INTO downloads " |
"(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, referrer, tab_url, " |
- " tab_referrer_url, http_method, by_ext_id, by_ext_name, etag, " |
- " last_modified) " |
+ " interrupt_reason, hash, end_time, opened, 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)); |
@@ -578,6 +585,7 @@ bool DownloadDatabase::CreateDownload(const DownloadRow& info) { |
statement_insert.BindInt64(column++, info.end_time.ToInternalValue()); |
statement_insert.BindInt(column++, info.opened ? 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()); |
statement_insert.BindString(column++, info.tab_referrer_url.spec()); |
statement_insert.BindString(column++, info.http_method); |