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

Unified Diff: content/browser/android/download_controller_android_impl.cc

Issue 417263004: Chrome Android PDF Downloads: Pass in HasUserGesture param to Java side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: content/browser/android/download_controller_android_impl.cc
diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc
index 2d042353036cd1e5dd65c82fa2aa6f37f72e95ba..08cea4be685598b5cbe345e07bf5ec67f7e0a299 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -22,6 +22,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_url_parameters.h"
#include "content/public/browser/global_request_id.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/common/referrer.h"
#include "jni/DownloadController_jni.h"
#include "net/cookies/cookie_options.h"
@@ -230,7 +231,8 @@ void DownloadControllerAndroidImpl::StartAndroidDownload(
Java_DownloadController_newHttpGetDownload(
env, GetJavaObject()->Controller(env).obj(), view.obj(), jurl.obj(),
juser_agent.obj(), jcontent_disposition.obj(), jmime_type.obj(),
- jcookie.obj(), jreferer.obj(), jfilename.obj(), info.total_bytes);
+ jcookie.obj(), jreferer.obj(), info.has_user_gesture, jfilename.obj(),
+ info.total_bytes);
}
void DownloadControllerAndroidImpl::OnDownloadStarted(
@@ -401,7 +403,8 @@ void DownloadControllerAndroidImpl::DangerousDownloadValidated(
}
DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid(
- net::URLRequest* request) {
+ net::URLRequest* request)
+ : has_user_gesture(false) {
request->GetResponseHeaderByName("content-disposition", &content_disposition);
if (request->response_headers())
@@ -416,6 +419,11 @@ DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid(
original_url = request->url_chain().front();
url = request->url_chain().back();
}
+
+ const content::ResourceRequestInfo* info =
+ content::ResourceRequestInfo::ForRequest(request);
+ if (info)
+ has_user_gesture = info->HasUserGesture();
}
DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {}

Powered by Google App Engine
This is Rietveld 408576698