| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 61   // 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 | 
| 62   // SuccessState indicating the outcome of the download, the path to the | 62   // SuccessState indicating the outcome of the download, the path to the | 
| 63   // downloaded page (relative to |OfflineRootDirectoryPath()|, and the title of | 63   // downloaded page (relative to |OfflineRootDirectoryPath()|, and the title of | 
| 64   // the url, and returns void. | 64   // the url, and returns void. | 
| 65   // The path to downloaded file and title should not be used in case of | 65   // The path to downloaded file and title should not be used in case of | 
| 66   // failure. | 66   // failure. | 
| 67   using DownloadCompletion = base::Callback<void(const GURL&, | 67   using DownloadCompletion = base::Callback<void(const GURL&, | 
| 68                                                  const GURL&, | 68                                                  const GURL&, | 
| 69                                                  SuccessState, | 69                                                  SuccessState, | 
| 70                                                  const base::FilePath&, | 70                                                  const base::FilePath&, | 
|  | 71                                                  int64_t size, | 
| 71                                                  const std::string&)>; | 72                                                  const std::string&)>; | 
| 72 | 73 | 
| 73   // Create a URL downloader with completion callbacks for downloads and | 74   // Create a URL downloader with completion callbacks for downloads and | 
| 74   // deletions. The completion callbacks will be called with the original url | 75   // deletions. The completion callbacks will be called with the original url | 
| 75   // and a boolean indicating success. For downloads, if distillation was | 76   // and a boolean indicating success. For downloads, if distillation was | 
| 76   // successful, it will also include the distilled url and extracted title. | 77   // successful, it will also include the distilled url and extracted title. | 
| 77   URLDownloader( | 78   URLDownloader( | 
| 78       dom_distiller::DistillerFactory* distiller_factory, | 79       dom_distiller::DistillerFactory* distiller_factory, | 
| 79       reading_list::ReadingListDistillerPageFactory* distiller_page_factory, | 80       reading_list::ReadingListDistillerPageFactory* distiller_page_factory, | 
| 80       PrefService* prefs, | 81       PrefService* prefs, | 
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 174   dom_distiller::DistillerFactory* distiller_factory_; | 175   dom_distiller::DistillerFactory* distiller_factory_; | 
| 175   PrefService* pref_service_; | 176   PrefService* pref_service_; | 
| 176   const DownloadCompletion download_completion_; | 177   const DownloadCompletion download_completion_; | 
| 177   const SuccessCompletion delete_completion_; | 178   const SuccessCompletion delete_completion_; | 
| 178 | 179 | 
| 179   std::deque<Task> tasks_; | 180   std::deque<Task> tasks_; | 
| 180   bool working_; | 181   bool working_; | 
| 181   base::FilePath base_directory_; | 182   base::FilePath base_directory_; | 
| 182   GURL original_url_; | 183   GURL original_url_; | 
| 183   GURL distilled_url_; | 184   GURL distilled_url_; | 
|  | 185   int64_t saved_size_; | 
| 184   std::string mime_type_; | 186   std::string mime_type_; | 
| 185   // Fetcher used to redownload the document and save it in the sandbox. | 187   // Fetcher used to redownload the document and save it in the sandbox. | 
| 186   std::unique_ptr<net::URLFetcher> fetcher_; | 188   std::unique_ptr<net::URLFetcher> fetcher_; | 
| 187   // URLRequestContextGetter needed for the URLFetcher. | 189   // URLRequestContextGetter needed for the URLFetcher. | 
| 188   scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 190   scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 
| 189   std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; | 191   std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; | 
| 190   base::CancelableTaskTracker task_tracker_; | 192   base::CancelableTaskTracker task_tracker_; | 
| 191 | 193 | 
| 192   DISALLOW_COPY_AND_ASSIGN(URLDownloader); | 194   DISALLOW_COPY_AND_ASSIGN(URLDownloader); | 
| 193 }; | 195 }; | 
| 194 | 196 | 
| 195 #endif  // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 197 #endif  // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 
| OLD | NEW | 
|---|