Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 // outcome and returns void. | 47 // outcome and returns void. |
| 48 using SuccessCompletion = base::Callback<void(const GURL&, bool)>; | 48 using SuccessCompletion = base::Callback<void(const GURL&, bool)>; |
| 49 | 49 |
| 50 // A download completion callback that takes, in order, the GURL that was | 50 // A download completion callback that takes, in order, the GURL that was |
| 51 // downloaded, a SuccessState indicating the outcome of the download, the | 51 // downloaded, a SuccessState indicating the outcome of the download, the |
| 52 // path to the downloaded page (relative to |OfflineRootDirectoryPath()|, and | 52 // path to the downloaded page (relative to |OfflineRootDirectoryPath()|, and |
| 53 // the title of the url, and returns void. | 53 // the title of the url, and returns void. |
| 54 // The path to downloaded file and title should not be used in case of | 54 // The path to downloaded file and title should not be used in case of |
| 55 // failure. | 55 // failure. |
| 56 using DownloadCompletion = base::Callback<void(const GURL&, | 56 using DownloadCompletion = base::Callback<void(const GURL&, |
| 57 const GURL&, | |
| 57 SuccessState, | 58 SuccessState, |
| 58 const base::FilePath&, | 59 const base::FilePath&, |
| 59 const std::string&)>; | 60 const std::string&)>; |
| 60 | 61 |
| 61 // Create a URL downloader with completion callbacks for downloads and | 62 // Create a URL downloader with completion callbacks for downloads and |
| 62 // deletions. The completion callbacks will be called with the original url | 63 // deletions. The completion callbacks will be called with the original url |
| 63 // and a boolean indicating success. For downloads, if distillation was | 64 // and a boolean indicating success. For downloads, if distillation was |
| 64 // successful, it will also include the distilled url and extracted title. | 65 // successful, it will also include the distilled url and extracted title. |
| 65 URLDownloader( | 66 URLDownloader( |
| 66 dom_distiller::DomDistillerService* distiller_service, | 67 dom_distiller::DomDistillerService* distiller_service, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 images, | 125 images, |
| 125 const std::string& html); | 126 const std::string& html); |
| 126 // Callback for distillation completion. | 127 // Callback for distillation completion. |
| 127 void DistillerCallback( | 128 void DistillerCallback( |
| 128 const GURL& pageURL, | 129 const GURL& pageURL, |
| 129 const std::string& html, | 130 const std::string& html, |
| 130 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& | 131 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& |
| 131 images, | 132 images, |
| 132 const std::string& title); | 133 const std::string& title); |
| 133 | 134 |
| 135 // A callback called if the URL passed to the distilled leaded to a | |
|
jif
2017/01/20 10:23:19
needs verification:
s/leaded/led/
Olivier
2017/01/20 10:47:07
Done.
| |
| 136 // redirection. | |
| 137 void RedirectionCallback(const GURL& page_url, const GURL& redirected_url); | |
| 138 | |
| 134 dom_distiller::DomDistillerService* distiller_service_; | 139 dom_distiller::DomDistillerService* distiller_service_; |
| 135 reading_list::ReadingListDistillerPageFactory* distiller_page_factory_; | 140 reading_list::ReadingListDistillerPageFactory* distiller_page_factory_; |
| 136 PrefService* pref_service_; | 141 PrefService* pref_service_; |
| 137 const DownloadCompletion download_completion_; | 142 const DownloadCompletion download_completion_; |
| 138 const SuccessCompletion delete_completion_; | 143 const SuccessCompletion delete_completion_; |
| 139 std::deque<Task> tasks_; | 144 std::deque<Task> tasks_; |
| 140 bool working_; | 145 bool working_; |
| 141 base::FilePath base_directory_; | 146 base::FilePath base_directory_; |
| 147 GURL distilled_url_; | |
| 142 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; | 148 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; |
| 143 base::CancelableTaskTracker task_tracker_; | 149 base::CancelableTaskTracker task_tracker_; |
| 144 | 150 |
| 145 DISALLOW_COPY_AND_ASSIGN(URLDownloader); | 151 DISALLOW_COPY_AND_ASSIGN(URLDownloader); |
| 146 }; | 152 }; |
| 147 | 153 |
| 148 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 154 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ |
| OLD | NEW |