Chromium Code Reviews| Index: content/browser/download/download_request_core.cc |
| diff --git a/content/browser/download/download_request_core.cc b/content/browser/download/download_request_core.cc |
| index f23dcda4bf2270fd276a3f387260bdb0b76bbd3c..5ae735b8d6b0547f3514b176618c46d538553833 100644 |
| --- a/content/browser/download/download_request_core.cc |
| +++ b/content/browser/download/download_request_core.cc |
| @@ -45,6 +45,10 @@ namespace content { |
| namespace { |
| +// Mime type of download resource that should trigger handoff to OfflinePages |
| +// backend for full page load+snapshot. |
| +const char kHTMLType[] = "text/html"; |
| + |
| // This is a UserData::Data that will be attached to a URLRequest as a |
| // side-channel for passing download parameters. |
| class DownloadRequestData : public base::SupportsUserData::Data { |
| @@ -259,6 +263,13 @@ bool DownloadRequestCore::OnResponseStarted( |
| save_info_.get()) |
| : DOWNLOAD_INTERRUPT_REASON_NONE; |
| + // If the download resource is an HTML page, interrupt this download with |
| + // a result code that allows handoff to the OfflinePage backend. |
| + if (result == DOWNLOAD_INTERRUPT_REASON_NONE && |
| + override_mime_type == kHTMLType) { |
| + result = DOWNLOAD_INTERRUPT_REASON_PAGE_DOWNLOAD_HANDOFF; |
|
jianli
2016/11/23 01:27:32
Do we want to return instead?
|
| + } |
| + |
| std::unique_ptr<DownloadCreateInfo> create_info = |
| CreateDownloadCreateInfo(result); |
| if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { |