| 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 #ifndef CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 virtual void OnUrlDownloaderStarted( | 33 virtual void OnUrlDownloaderStarted( |
| 34 std::unique_ptr<DownloadCreateInfo> download_create_info, | 34 std::unique_ptr<DownloadCreateInfo> download_create_info, |
| 35 std::unique_ptr<ByteStreamReader> stream_reader, | 35 std::unique_ptr<ByteStreamReader> stream_reader, |
| 36 const DownloadUrlParameters::OnStartedCallback& callback) = 0; | 36 const DownloadUrlParameters::OnStartedCallback& callback) = 0; |
| 37 | 37 |
| 38 // Called after the connection is cannceled or finished. | 38 // Called after the connection is cannceled or finished. |
| 39 virtual void OnUrlDownloaderStopped(UrlDownloader* downloader) = 0; | 39 virtual void OnUrlDownloaderStopped(UrlDownloader* downloader) = 0; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 UrlDownloader(std::unique_ptr<net::URLRequest> request, | 42 UrlDownloader(std::unique_ptr<net::URLRequest> request, |
| 43 base::WeakPtr<Delegate> delegate); | 43 base::WeakPtr<Delegate> delegate, |
| 44 bool is_parallel_request); |
| 44 ~UrlDownloader() override; | 45 ~UrlDownloader() override; |
| 45 | 46 |
| 46 static std::unique_ptr<UrlDownloader> BeginDownload( | 47 static std::unique_ptr<UrlDownloader> BeginDownload( |
| 47 base::WeakPtr<UrlDownloader::Delegate> delegate, | 48 base::WeakPtr<UrlDownloader::Delegate> delegate, |
| 48 std::unique_ptr<net::URLRequest> request, | 49 std::unique_ptr<net::URLRequest> request, |
| 49 const Referrer& referrer); | 50 const Referrer& referrer, |
| 51 bool is_parallel_request); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 class RequestHandle; | 54 class RequestHandle; |
| 53 | 55 |
| 54 void Start(); | 56 void Start(); |
| 55 | 57 |
| 56 // URLRequest::Delegate: | 58 // URLRequest::Delegate: |
| 57 void OnReceivedRedirect(net::URLRequest* request, | 59 void OnReceivedRedirect(net::URLRequest* request, |
| 58 const net::RedirectInfo& redirect_info, | 60 const net::RedirectInfo& redirect_info, |
| 59 bool* defer_redirect) override; | 61 bool* defer_redirect) override; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 84 // Live on UI thread, post task to call |delegate_| functions. | 86 // Live on UI thread, post task to call |delegate_| functions. |
| 85 base::WeakPtr<Delegate> delegate_; | 87 base::WeakPtr<Delegate> delegate_; |
| 86 DownloadRequestCore core_; | 88 DownloadRequestCore core_; |
| 87 | 89 |
| 88 base::WeakPtrFactory<UrlDownloader> weak_ptr_factory_; | 90 base::WeakPtrFactory<UrlDownloader> weak_ptr_factory_; |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 } // namespace content | 93 } // namespace content |
| 92 | 94 |
| 93 #endif // CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_ | 95 #endif // CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_ |
| OLD | NEW |