Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/download/url_downloader.h" | 5 #include "content/browser/download/url_downloader.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/threading/sequenced_task_runner_handle.h" | 10 #include "base/threading/sequenced_task_runner_handle.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(RequestHandle); | 61 DISALLOW_COPY_AND_ASSIGN(RequestHandle); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 std::unique_ptr<UrlDownloader> UrlDownloader::BeginDownload( | 65 std::unique_ptr<UrlDownloader> UrlDownloader::BeginDownload( |
| 66 base::WeakPtr<UrlDownloader::Delegate> delegate, | 66 base::WeakPtr<UrlDownloader::Delegate> delegate, |
| 67 std::unique_ptr<net::URLRequest> request, | 67 std::unique_ptr<net::URLRequest> request, |
| 68 const Referrer& referrer, | 68 const Referrer& referrer, |
| 69 bool is_parallel_request) { | 69 bool is_parallel_request) { |
| 70 Referrer::SetReferrerForRequest(request.get(), referrer); | 70 Referrer sanitized_referrer = |
| 71 Referrer::SanitizeForRequest(request->url(), referrer); | |
|
asanka
2017/06/08 16:44:30
Whoa. This step is pretty easy to miss.
David Trainor- moved to gerrit
2017/06/08 17:16:38
Should we have a bool sanitize in SetReferrerForRe
svaldez
2017/06/08 18:26:07
Hmm, it looks like most other callers sanitize it
| |
| 72 Referrer::SetReferrerForRequest(request.get(), sanitized_referrer); | |
| 71 | 73 |
| 72 if (request->url().SchemeIs(url::kBlobScheme)) | 74 if (request->url().SchemeIs(url::kBlobScheme)) |
| 73 return nullptr; | 75 return nullptr; |
| 74 | 76 |
| 75 // From this point forward, the |UrlDownloader| is responsible for | 77 // From this point forward, the |UrlDownloader| is responsible for |
| 76 // |started_callback|. | 78 // |started_callback|. |
| 77 std::unique_ptr<UrlDownloader> downloader( | 79 std::unique_ptr<UrlDownloader> downloader( |
| 78 new UrlDownloader(std::move(request), delegate, is_parallel_request)); | 80 new UrlDownloader(std::move(request), delegate, is_parallel_request)); |
| 79 downloader->Start(); | 81 downloader->Start(); |
| 80 | 82 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 } | 236 } |
| 235 | 237 |
| 236 void UrlDownloader::Destroy() { | 238 void UrlDownloader::Destroy() { |
| 237 BrowserThread::PostTask( | 239 BrowserThread::PostTask( |
| 238 BrowserThread::UI, FROM_HERE, | 240 BrowserThread::UI, FROM_HERE, |
| 239 base::Bind(&UrlDownloader::Delegate::OnUrlDownloaderStopped, delegate_, | 241 base::Bind(&UrlDownloader::Delegate::OnUrlDownloaderStopped, delegate_, |
| 240 this)); | 242 this)); |
| 241 } | 243 } |
| 242 | 244 |
| 243 } // namespace content | 245 } // namespace content |
| OLD | NEW |