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

Unified Diff: chrome/browser/android/download/download_controller.cc

Issue 2642683005: reintroduce InterceptDownloadResourceThrottle for some OMA DRM downloads (Closed)
Patch Set: comments Created 3 years, 11 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
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 c77b0f282df2296204a05c8ee2f9d44748d1b436..f66003049499ef2a4fb85de63f1d170b4529042f 100644
--- a/chrome/browser/android/download/download_controller.cc
+++ b/chrome/browser/android/download/download_controller.cc
@@ -219,6 +219,54 @@ void DownloadController::AcquireFileAccessPermission(
RequestFileAccess(callback_id);
}
+void DownloadController::CreateGETDownload(
+ const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const DownloadInfo& info) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&DownloadController::StartAndroidDownload,
+ base::Unretained(this),
+ wc_getter, info));
+}
+
+void DownloadController::StartAndroidDownload(
+ const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const DownloadInfo& info) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ WebContents* web_contents = wc_getter.Run();
+ if (!web_contents) {
+ // The view went away. Can't proceed.
+ LOG(ERROR) << "Download failed on URL:" << info.url.spec();
+ return;
+ }
+
+ AcquireFileAccessPermission(
+ web_contents,
+ base::Bind(&DownloadController::StartAndroidDownloadInternal,
+ base::Unretained(this), wc_getter, info));
+}
+
+void DownloadController::StartAndroidDownloadInternal(
+ const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
+ const DownloadInfo& info, bool allowed) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ if (!allowed)
+ return;
+
+ WebContents* web_contents = wc_getter.Run();
+ if (!web_contents)
+ return;
David Trainor- moved to gerrit 2017/01/24 17:13:35 Should this case log a similar error to StartAndro
qinmin 2017/01/24 17:32:23 Done.
+
+ ChromeDownloadDelegate::FromWebContents(web_contents)->
+ EnqueueDownloadManagerRequest(
+ info.url.spec(), info.user_agent,
+ info.content_disposition, info.original_mime_type,
+ info.cookie, info.referer);
+}
+
bool DownloadController::HasFileAccessPermission(
ui::WindowAndroid* window_android) {
ScopedJavaLocalRef<jobject> jwindow_android = window_android->GetJavaObject();

Powered by Google App Engine
This is Rietveld 408576698