| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ |
| 6 #define IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 reading_list::ReadingListDistillerPageDelegate { | 41 reading_list::ReadingListDistillerPageDelegate { |
| 42 friend class MockURLDownloader; | 42 friend class MockURLDownloader; |
| 43 | 43 |
| 44 public: | 44 public: |
| 45 // And enum indicating different download outcomes. | 45 // And enum indicating different download outcomes. |
| 46 enum SuccessState { | 46 enum SuccessState { |
| 47 // The URL was correctly downloaded and an offline version is not available. | 47 // The URL was correctly downloaded and an offline version is not available. |
| 48 DOWNLOAD_SUCCESS, | 48 DOWNLOAD_SUCCESS, |
| 49 // The URL was already available offline. No action was done. | 49 // The URL was already available offline. No action was done. |
| 50 DOWNLOAD_EXISTS, | 50 DOWNLOAD_EXISTS, |
| 51 // The URL could not be downloaded because of a temporary error. Client may | 51 // The URL could not be downloaded because of an error. Client may want to |
| 52 // want to try again later. | 52 // try again later. |
| 53 ERROR_RETRY, | 53 ERROR, |
| 54 // The URL could not be dowmloaded and URLDownloader thinks a retry would | |
| 55 // end with the same result. There is no need to retry. | |
| 56 ERROR_PERMANENT | |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 // A completion callback that takes a GURL and a bool indicating the | 56 // A completion callback that takes a GURL and a bool indicating the |
| 60 // outcome and returns void. | 57 // outcome and returns void. |
| 61 using SuccessCompletion = base::Callback<void(const GURL&, bool)>; | 58 using SuccessCompletion = base::Callback<void(const GURL&, bool)>; |
| 62 | 59 |
| 63 // A download completion callback that takes, in order, the GURL that was | 60 // A download completion callback that takes, in order, the GURL that was |
| 64 // downloaded, the GURL of the page that was downloaded after redirections, a | 61 // downloaded, the GURL of the page that was downloaded after redirections, a |
| 65 // SuccessState indicating the outcome of the download, the path to the | 62 // SuccessState indicating the outcome of the download, the path to the |
| 66 // downloaded page (relative to |OfflineRootDirectoryPath()|, and the title of | 63 // downloaded page (relative to |OfflineRootDirectoryPath()|, and the title of |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 std::unique_ptr<net::URLFetcher> fetcher_; | 186 std::unique_ptr<net::URLFetcher> fetcher_; |
| 190 // URLRequestContextGetter needed for the URLFetcher. | 187 // URLRequestContextGetter needed for the URLFetcher. |
| 191 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 188 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| 192 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; | 189 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; |
| 193 base::CancelableTaskTracker task_tracker_; | 190 base::CancelableTaskTracker task_tracker_; |
| 194 | 191 |
| 195 DISALLOW_COPY_AND_ASSIGN(URLDownloader); | 192 DISALLOW_COPY_AND_ASSIGN(URLDownloader); |
| 196 }; | 193 }; |
| 197 | 194 |
| 198 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 195 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ |
| OLD | NEW |