Cleanup: It is better to reuse the content API which already exist.

When saving a media file, we can reuse the WebContents::SaveFrame().

Review URL: https://codereview.chromium.org/260043002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266708 0039d316-1c4b-4281-b951-d872f2087c98
parent a1273cb8
...@@ -1541,24 +1541,8 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { ...@@ -1541,24 +1541,8 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
const GURL& referrer = const GURL& referrer =
params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; params_.frame_url.is_empty() ? params_.page_url : params_.frame_url;
const GURL& url = params_.src_url; const GURL& url = params_.src_url;
int64 post_id = -1; source_web_contents_->SaveFrame(url, content::Referrer(
if (url == source_web_contents_->GetURL()) { referrer, params_.referrer_policy));
const NavigationEntry* entry =
source_web_contents_->GetController().GetActiveEntry();
if (entry)
post_id = entry->GetPostID();
}
DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_);
scoped_ptr<DownloadUrlParameters> dl_params(
DownloadUrlParameters::FromWebContents(source_web_contents_, url));
dl_params->set_referrer(
content::Referrer(referrer, params_.referrer_policy));
dl_params->set_post_id(post_id);
dl_params->set_prefer_cache(true);
if (post_id >= 0)
dl_params->set_method("POST");
dl_params->set_prompt(true);
dlm->DownloadUrl(dl_params.Pass());
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment