diff options
author | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-04 20:05:14 +0000 |
---|---|---|
committer | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-04 20:05:14 +0000 |
commit | c5a5c084acc5c25f14920e559f69dd6ae3267fa5 (patch) | |
tree | 2ba655fefd77c2ea419559a4d8b53e13434f4795 /chrome/browser/tab_contents | |
parent | 6ac091784670a4e1391053beae4bf50f0fb1612b (diff) | |
download | chromium_src-c5a5c084acc5c25f14920e559f69dd6ae3267fa5.zip chromium_src-c5a5c084acc5c25f14920e559f69dd6ae3267fa5.tar.gz chromium_src-c5a5c084acc5c25f14920e559f69dd6ae3267fa5.tar.bz2 |
Refactor DownloadManager::DownloadUrl() to allow it to take many parameters.
Review URL: http://codereview.chromium.org/10232010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu.cc | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 9bf97a0..de05fcf 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -62,6 +62,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_save_info.h" +#include "content/public/browser/download_url_parameters.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" @@ -86,8 +87,14 @@ #include "chrome/browser/chromeos/extensions/file_manager_util.h" #endif +using WebKit::WebContextMenuData; +using WebKit::WebMediaPlayerAction; +using WebKit::WebPluginAction; +using WebKit::WebString; +using WebKit::WebURL; using content::ChildProcessSecurityPolicy; using content::DownloadManager; +using content::DownloadUrlParameters; using content::NavigationController; using content::NavigationEntry; using content::OpenURLParams; @@ -95,11 +102,6 @@ using content::RenderViewHost; using content::SSLStatus; using content::UserMetricsAction; using content::WebContents; -using WebKit::WebContextMenuData; -using WebKit::WebMediaPlayerAction; -using WebKit::WebPluginAction; -using WebKit::WebURL; -using WebKit::WebString; namespace { @@ -1517,14 +1519,12 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { save_info.prompt_for_save_location = true; DownloadManager* dlm = DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); - dlm->DownloadUrl(url, - referrer, - params_.frame_charset, - false, // Don't prefer_cache - -1, // No POST id - save_info, - source_web_contents_, - DownloadManager::OnStartedCallback()); + scoped_ptr<DownloadUrlParameters> dl_params( + DownloadUrlParameters::FromWebContents( + source_web_contents_, url, save_info)); + dl_params->set_referrer(referrer); + dl_params->set_referrer_encoding(params_.frame_charset); + dlm->DownloadUrl(dl_params.Pass()); break; } @@ -1546,14 +1546,15 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { } DownloadManager* dlm = DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); - dlm->DownloadUrl(url, - referrer, - "", - true, // prefer_cache - post_id, - save_info, - source_web_contents_, - DownloadManager::OnStartedCallback()); + scoped_ptr<DownloadUrlParameters> dl_params( + DownloadUrlParameters::FromWebContents( + source_web_contents_, url, save_info)); + dl_params->set_referrer(referrer); + dl_params->set_post_id(post_id); + dl_params->set_prefer_cache(true); + if (post_id >= 0) + dl_params->set_method("POST"); + dlm->DownloadUrl(dl_params.Pass()); break; } |