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

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

Issue 13859009: Adding a call to support download initiated context menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 bd71d044c3fb1c6b659ffdc8372cc4f2d2a3594f..9bf80f14af7a42a1b9c938eadeebb728f81e80c7 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -16,6 +16,7 @@
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/web_contents_view.h"
@@ -316,6 +317,25 @@ DownloadControllerAndroidImpl::JavaObject*
return java_object_;
}
+void DownloadControllerAndroidImpl::StartContextMenuDownload(
+ const ContextMenuParams& params, WebContents* web_contents, bool is_link) {
+ const GURL& url = is_link ? params.link_url : params.src_url;
+ const GURL& referrer = params.frame_url.is_empty() ?
+ params.page_url : params.frame_url;
+ DownloadManager* dlm = content::BrowserContext::GetDownloadManager(
nilesh 2013/04/12 16:27:45 dont need content:: here and below
nilesh 2013/04/12 16:27:45 We are supposed to use the _impl version inside co
qinmin 2013/04/15 18:56:51 Done.
qinmin 2013/04/15 18:56:51 Done.
+ web_contents->GetBrowserContext());
+ scoped_ptr<content::DownloadUrlParameters> dl_params(
+ DownloadUrlParameters::FromWebContents(web_contents, url));
+ dl_params->set_referrer(
+ Referrer(referrer, params.referrer_policy));
+ if (!is_link)
nilesh 2013/04/12 16:27:45 if (is_link) .. else .. I find this easier to read
qinmin 2013/04/15 18:56:51 Done.
+ dl_params->set_prefer_cache(true);
+ else
+ dl_params->set_referrer_encoding(params.frame_charset);
nilesh 2013/04/12 16:27:45 Why is referrer encoding only set for is_link?
qinmin 2013/04/15 18:56:51 This is from the upstream saving logic. I think fo
+ dl_params->set_prompt(false);
+ dlm->DownloadUrl(dl_params.Pass());
+}
+
DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid(
net::URLRequest* request) {
request->GetResponseHeaderByName("content-disposition", &content_disposition);

Powered by Google App Engine
This is Rietveld 408576698