[Downloads/History] Add tab-url and tab-referrer-url to DownloadRow
Also add a README.md file to components/test/data/history explaining how
to generate a history.NN.sql file.
[email protected], [email protected], [email protected]
BUG=602403
Review URL: https://codereview.chromium.org/1875033005
Cr-Commit-Position: refs/heads/master@{#387169}
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc
index 0e6d94f..c67735c 100644
--- a/content/browser/download/download_browsertest.cc
+++ b/content/browser/download/download_browsertest.cc
@@ -1823,6 +1823,8 @@
base::FilePath(),
url_chain,
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),
@@ -1895,6 +1897,8 @@
base::FilePath(),
url_chain,
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),
@@ -1954,6 +1958,8 @@
base::FilePath(),
url_chain,
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),
@@ -2018,6 +2024,8 @@
base::FilePath(),
url_chain,
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),
@@ -2088,6 +2096,8 @@
base::FilePath(),
url_chain,
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),
@@ -2167,6 +2177,8 @@
base::FilePath(),
url_chain,
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),
diff --git a/content/browser/download/download_item_factory.h b/content/browser/download/download_item_factory.h
index 2ccb2cb..d8cff28c 100644
--- a/content/browser/download/download_item_factory.h
+++ b/content/browser/download/download_item_factory.h
@@ -47,6 +47,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_refererr_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 2794afe7..66f3106 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -113,6 +113,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_refererr_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
@@ -132,6 +134,8 @@
target_path_(target_path),
url_chain_(url_chain),
referrer_url_(referrer_url),
+ tab_url_(tab_url),
+ tab_referrer_url_(tab_refererr_url),
mime_type_(mime_type),
original_mime_type_(original_mime_type),
total_bytes_(total_bytes),
diff --git a/content/browser/download/download_item_impl.h b/content/browser/download/download_item_impl.h
index be9a2c3..52fbbb0af 100644
--- a/content/browser/download/download_item_impl.h
+++ b/content/browser/download/download_item_impl.h
@@ -58,6 +58,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_referrer_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 9509f54..db6bc81 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -120,6 +120,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_refererr_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
@@ -134,27 +136,11 @@
DownloadInterruptReason interrupt_reason,
bool opened,
const net::BoundNetLog& bound_net_log) override {
- return new DownloadItemImpl(delegate,
- guid,
- download_id,
- current_path,
- target_path,
- url_chain,
- referrer_url,
- mime_type,
- original_mime_type,
- start_time,
- end_time,
- etag,
- last_modified,
- received_bytes,
- total_bytes,
- hash,
- state,
- danger_type,
- interrupt_reason,
- opened,
- bound_net_log);
+ return new DownloadItemImpl(
+ delegate, guid, download_id, current_path, target_path, url_chain,
+ referrer_url, tab_url, tab_refererr_url, mime_type, original_mime_type,
+ start_time, end_time, etag, last_modified, received_bytes, total_bytes,
+ hash, state, danger_type, interrupt_reason, opened, bound_net_log);
}
DownloadItemImpl* CreateActiveItem(
@@ -619,6 +605,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_refererr_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
@@ -638,26 +626,10 @@
}
DCHECK(!ContainsKey(downloads_by_guid_, guid));
DownloadItemImpl* item = item_factory_->CreatePersistedItem(
- this,
- guid,
- id,
- current_path,
- target_path,
- url_chain,
- referrer_url,
- mime_type,
- original_mime_type,
- start_time,
- end_time,
- etag,
- last_modified,
- received_bytes,
- total_bytes,
- hash,
- state,
- danger_type,
- interrupt_reason,
- opened,
+ this, guid, id, current_path, target_path, url_chain, referrer_url,
+ tab_url, tab_refererr_url, mime_type, original_mime_type, start_time,
+ end_time, etag, last_modified, received_bytes, total_bytes, hash, state,
+ danger_type, interrupt_reason, opened,
net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD));
downloads_[id] = item;
downloads_by_guid_[guid] = item;
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index 21524c9..79b8d4f 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -88,6 +88,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_refererr_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index 36bc00fc..dfc01621 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -85,6 +85,8 @@
base::FilePath(),
std::vector<GURL>(),
GURL(),
+ GURL(),
+ GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time(),
@@ -249,6 +251,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_referrer_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
@@ -318,6 +322,8 @@
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
+ const GURL& tab_url,
+ const GURL& tab_referrer_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
@@ -753,6 +759,8 @@
base::FilePath(),
std::vector<GURL>(),
GURL("http://example.com/a"),
+ GURL("http://example.com/a"),
+ GURL("http://example.com/a"),
"application/octet-stream",
"application/octet-stream",
base::Time::Now(),