| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const std::string& html, | 106 const std::string& html, |
| 107 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& | 107 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& |
| 108 images); | 108 images); |
| 109 // Saves |html| to disk in the correct location for |url|; returns success. | 109 // Saves |html| to disk in the correct location for |url|; returns success. |
| 110 bool SaveHTMLForURL(std::string html, const GURL& url); | 110 bool SaveHTMLForURL(std::string html, const GURL& url); |
| 111 // Downloads |url|, depending on |offlineURLExists| state. | 111 // Downloads |url|, depending on |offlineURLExists| state. |
| 112 virtual void DownloadURL(GURL url, bool offlineURLExists); | 112 virtual void DownloadURL(GURL url, bool offlineURLExists); |
| 113 // Saves distilled html to disk, including saving images and main file. | 113 // Saves distilled html to disk, including saving images and main file. |
| 114 SuccessState SaveDistilledHTML( | 114 SuccessState SaveDistilledHTML( |
| 115 const GURL& url, | 115 const GURL& url, |
| 116 std::vector<dom_distiller::DistillerViewerInterface::ImageInfo> images, | 116 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& |
| 117 std::string html); | 117 images, |
| 118 const std::string& html); |
| 118 // Callback for distillation completion. | 119 // Callback for distillation completion. |
| 119 void DistillerCallback( | 120 void DistillerCallback( |
| 120 const GURL& pageURL, | 121 const GURL& pageURL, |
| 121 const std::string& html, | 122 const std::string& html, |
| 122 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& | 123 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& |
| 123 images, | 124 images, |
| 124 const std::string& title); | 125 const std::string& title); |
| 125 | 126 |
| 126 dom_distiller::DomDistillerService* distiller_service_; | 127 dom_distiller::DomDistillerService* distiller_service_; |
| 127 PrefService* pref_service_; | 128 PrefService* pref_service_; |
| 128 const DownloadCompletion download_completion_; | 129 const DownloadCompletion download_completion_; |
| 129 const SuccessCompletion delete_completion_; | 130 const SuccessCompletion delete_completion_; |
| 130 std::deque<Task> tasks_; | 131 std::deque<Task> tasks_; |
| 131 bool working_; | 132 bool working_; |
| 132 base::FilePath base_directory_; | 133 base::FilePath base_directory_; |
| 133 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; | 134 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; |
| 134 base::CancelableTaskTracker task_tracker_; | 135 base::CancelableTaskTracker task_tracker_; |
| 135 | 136 |
| 136 DISALLOW_COPY_AND_ASSIGN(URLDownloader); | 137 DISALLOW_COPY_AND_ASSIGN(URLDownloader); |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 140 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ |
| OLD | NEW |