diff options
author | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 21:18:12 +0000 |
---|---|---|
committer | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 21:18:12 +0000 |
commit | 49d812e82f892a7d93e43a667dc2cb40164bc21e (patch) | |
tree | 01a6094be3e3957fe7524cdc9776f93565f0b14d /chrome/browser/extensions/api/downloads/downloads_api.cc | |
parent | ddf4216c55613f11562632bf91a10b665d9caecb (diff) | |
download | chromium_src-49d812e82f892a7d93e43a667dc2cb40164bc21e.zip chromium_src-49d812e82f892a7d93e43a667dc2cb40164bc21e.tar.gz chromium_src-49d812e82f892a7d93e43a667dc2cb40164bc21e.tar.bz2 |
Merge most instances of DownloadSaveInfo into DownloadUrlParams.
This simplifies the programmatic interface for downloads.
R=benjhayden@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11338045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/downloads/downloads_api.cc')
-rw-r--r-- | chrome/browser/extensions/api/downloads/downloads_api.cc | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index 963ac96..fc5ce8a 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc @@ -576,8 +576,17 @@ bool DownloadsDownloadFunction::RunImpl() { return false; } - scoped_ptr<content::DownloadSaveInfo> save_info( - new content::DownloadSaveInfo()); + Profile* current_profile = profile(); + if (include_incognito() && profile()->HasOffTheRecordProfile()) + current_profile = profile()->GetOffTheRecordProfile(); + + scoped_ptr<content::DownloadUrlParameters> download_params( + new content::DownloadUrlParameters( + download_url, + render_view_host()->GetProcess()->GetID(), + render_view_host()->GetRoutingID(), + current_profile->GetResourceContext())); + if (options.filename.get()) { // TODO(benjhayden): Make json_schema_compiler generate string16s instead of // std::strings. Can't get filename16 from options.ToValue() because that @@ -593,23 +602,11 @@ bool DownloadsDownloadFunction::RunImpl() { } // TODO(benjhayden) Ensure that this filename is interpreted as a path // relative to the default downloads directory without allowing '..'. - save_info->suggested_name = filename16; + download_params->set_suggested_name(filename16); } if (options.save_as.get()) - save_info->prompt_for_save_location = *options.save_as.get(); - - Profile* current_profile = profile(); - if (include_incognito() && profile()->HasOffTheRecordProfile()) - current_profile = profile()->GetOffTheRecordProfile(); - - scoped_ptr<content::DownloadUrlParameters> download_params( - new content::DownloadUrlParameters( - download_url, - render_view_host()->GetProcess()->GetID(), - render_view_host()->GetRoutingID(), - current_profile->GetResourceContext(), - save_info.Pass())); + download_params->set_prompt(*options.save_as.get()); if (options.headers.get()) { typedef extensions::api::downloads::HeaderNameValuePair HeaderNameValuePair; |