OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/android/download_controller_android_impl.h" | 5 #include "content/browser/android/download_controller_android_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/android/context_utils.h" | 10 #include "base/android/context_utils.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return; | 74 return; |
75 | 75 |
76 const GURL& url = is_link ? params.link_url : params.src_url; | 76 const GURL& url = is_link ? params.link_url : params.src_url; |
77 const GURL& referring_url = | 77 const GURL& referring_url = |
78 params.frame_url.is_empty() ? params.page_url : params.frame_url; | 78 params.frame_url.is_empty() ? params.page_url : params.frame_url; |
79 content::DownloadManagerImpl* dlm = | 79 content::DownloadManagerImpl* dlm = |
80 static_cast<content::DownloadManagerImpl*>( | 80 static_cast<content::DownloadManagerImpl*>( |
81 content::BrowserContext::GetDownloadManager( | 81 content::BrowserContext::GetDownloadManager( |
82 web_contents->GetBrowserContext())); | 82 web_contents->GetBrowserContext())); |
83 std::unique_ptr<content::DownloadUrlParameters> dl_params( | 83 std::unique_ptr<content::DownloadUrlParameters> dl_params( |
84 content::DownloadUrlParameters::FromWebContents(web_contents, url)); | 84 content::DownloadUrlParameters::CreateForWebContentsMainFrame( |
| 85 web_contents, url)); |
85 content::Referrer referrer = content::Referrer::SanitizeForRequest( | 86 content::Referrer referrer = content::Referrer::SanitizeForRequest( |
86 url, | 87 url, |
87 content::Referrer(referring_url.GetAsReferrer(), params.referrer_policy)); | 88 content::Referrer(referring_url.GetAsReferrer(), params.referrer_policy)); |
88 dl_params->set_referrer(referrer); | 89 dl_params->set_referrer(referrer); |
89 if (is_link) | 90 if (is_link) |
90 dl_params->set_referrer_encoding(params.frame_charset); | 91 dl_params->set_referrer_encoding(params.frame_charset); |
91 net::HttpRequestHeaders headers; | 92 net::HttpRequestHeaders headers; |
92 headers.AddHeadersFromString(extra_headers); | 93 headers.AddHeadersFromString(extra_headers); |
93 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();) | 94 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();) |
94 dl_params->add_request_header(it.name(), it.value()); | 95 dl_params->add_request_header(it.name(), it.value()); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 if (info) | 609 if (info) |
609 has_user_gesture = info->HasUserGesture(); | 610 has_user_gesture = info->HasUserGesture(); |
610 } | 611 } |
611 | 612 |
612 DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid( | 613 DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid( |
613 const DownloadInfoAndroid& other) = default; | 614 const DownloadInfoAndroid& other) = default; |
614 | 615 |
615 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} | 616 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} |
616 | 617 |
617 } // namespace content | 618 } // namespace content |
OLD | NEW |