| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // The path of the offline webpage for the URL. The file may not exist. | 91 // The path of the offline webpage for the URL. The file may not exist. |
| 92 base::FilePath OfflineURLPagePath(const GURL& url); | 92 base::FilePath OfflineURLPagePath(const GURL& url); |
| 93 // Creates the offline directory for |url|. Returns true if successful or if | 93 // Creates the offline directory for |url|. Returns true if successful or if |
| 94 // the directory already exists. | 94 // the directory already exists. |
| 95 bool CreateOfflineURLDirectory(const GURL& url); | 95 bool CreateOfflineURLDirectory(const GURL& url); |
| 96 // Saves the |data| for image at |imageURL| to disk, for main URL |url|; | 96 // Saves the |data| for image at |imageURL| to disk, for main URL |url|; |
| 97 // puts path of saved file in |path| and returns whether save was successful. | 97 // puts path of saved file in |path| and returns whether save was successful. |
| 98 bool SaveImage(const GURL& url, | 98 bool SaveImage(const GURL& url, |
| 99 const GURL& imageURL, | 99 const GURL& imageURL, |
| 100 const std::string& data, | 100 const std::string& data, |
| 101 base::FilePath& path); | 101 std::string* image_name); |
| 102 // Saves images in |images| array to disk and replaces references in |html| to | 102 // Saves images in |images| array to disk and replaces references in |html| to |
| 103 // local path. Returns updated html. | 103 // local path. Returns updated html. |
| 104 std::string SaveAndReplaceImagesInHTML( | 104 std::string SaveAndReplaceImagesInHTML( |
| 105 const GURL& url, | 105 const GURL& url, |
| 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. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 131 std::deque<Task> tasks_; | 131 std::deque<Task> tasks_; |
| 132 bool working_; | 132 bool working_; |
| 133 base::FilePath base_directory_; | 133 base::FilePath base_directory_; |
| 134 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; | 134 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; |
| 135 base::CancelableTaskTracker task_tracker_; | 135 base::CancelableTaskTracker task_tracker_; |
| 136 | 136 |
| 137 DISALLOW_COPY_AND_ASSIGN(URLDownloader); | 137 DISALLOW_COPY_AND_ASSIGN(URLDownloader); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ | 140 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ |
| OLD | NEW |