| Index: chrome/browser/android/download/download_controller.cc
|
| diff --git a/chrome/browser/android/download/download_controller.cc b/chrome/browser/android/download/download_controller.cc
|
| index b90f310a7ee54d36a469ac3fbdba5da41087979e..4e0a5edc7aff6462887ed0defcde78c086e45635 100644
|
| --- a/chrome/browser/android/download/download_controller.cc
|
| +++ b/chrome/browser/android/download/download_controller.cc
|
| @@ -18,10 +18,12 @@
|
| #include "chrome/browser/android/download/chrome_download_delegate.h"
|
| #include "chrome/browser/android/download/dangerous_download_infobar_delegate.h"
|
| #include "chrome/browser/android/download/download_manager_service.h"
|
| +#include "chrome/browser/android/offline_pages/offline_page_utils.h"
|
| #include "chrome/browser/infobars/infobar_service.h"
|
| #include "chrome/browser/ui/android/view_android_helper.h"
|
| #include "content/public/browser/browser_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/download_interrupt_reasons.h"
|
| #include "content/public/browser/download_manager.h"
|
| #include "content/public/browser/download_url_parameters.h"
|
| #include "content/public/browser/render_process_host.h"
|
| @@ -57,6 +59,19 @@ WebContents* GetWebContents(int render_process_id, int render_view_id) {
|
| return WebContents::FromRenderViewHost(render_view_host);
|
| }
|
|
|
| +void DownloadItemCreationCallback(
|
| + BrowserContext* context,
|
| + const GURL& url,
|
| + DownloadItem* item,
|
| + content::DownloadInterruptReason interrupt_reason) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + if (interrupt_reason !=
|
| + content::DOWNLOAD_INTERRUPT_REASON_PAGE_DOWNLOAD_HANDOFF) {
|
| + return;
|
| + }
|
| + offline_pages::OfflinePageUtils::CreateOfflinePageDownload(context, url);
|
| +}
|
| +
|
| void CreateContextMenuDownload(int render_process_id,
|
| int render_view_id,
|
| const content::ContextMenuParams& params,
|
| @@ -93,6 +108,9 @@ void CreateContextMenuDownload(int render_process_id,
|
| if (!is_link && extra_headers.empty())
|
| dl_params->set_prefer_cache(true);
|
| dl_params->set_prompt(false);
|
| + dl_params->set_callback(base::Bind(DownloadItemCreationCallback,
|
| + web_contents->GetBrowserContext(),
|
| + dl_params->url()));
|
| dlm->DownloadUrl(std::move(dl_params));
|
| }
|
|
|
|
|