Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: components/history/core/browser/download_database.cc

Issue 1924473003: [Downloads] Use the initiating StoragePartition for resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/history/core/browser/download_database.h ('k') | components/history/core/browser/download_row.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « components/history/core/browser/download_database.h ('k') | components/history/core/browser/download_row.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698