Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: ios/chrome/browser/reading_list/url_downloader.h

Issue 2650593003: Store distilled URL during distillation in Reading List on iOS (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
41 DOWNLOAD_EXISTS, 41 DOWNLOAD_EXISTS,
42 ERROR_RETRY, 42 ERROR_RETRY,
43 ERROR_PERMANENT 43 ERROR_PERMANENT
44 }; 44 };
45 45
46 // A completion callback that takes a GURL and a bool indicating the 46 // A completion callback that takes a GURL and a bool indicating the
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, the GURL of the page that was downloaded after redirections, a
52 // path to the downloaded page (relative to |OfflineRootDirectoryPath()|, and 52 // SuccessState indicating the outcome of the download, the path to the
53 // the title of the url, and returns void. 53 // downloaded page (relative to |OfflineRootDirectoryPath()|, and the title of
54 // The path to downloaded file and title should not be used in case of 54 // the url, and returns void.
55 // The path to downloaded file and title should not be used in case of
55 // failure. 56 // failure.
56 using DownloadCompletion = base::Callback<void(const GURL&, 57 using DownloadCompletion = base::Callback<void(const GURL&,
58 const GURL&,
57 SuccessState, 59 SuccessState,
58 const base::FilePath&, 60 const base::FilePath&,
59 const std::string&)>; 61 const std::string&)>;
60 62
61 // Create a URL downloader with completion callbacks for downloads and 63 // Create a URL downloader with completion callbacks for downloads and
62 // deletions. The completion callbacks will be called with the original url 64 // deletions. The completion callbacks will be called with the original url
63 // and a boolean indicating success. For downloads, if distillation was 65 // and a boolean indicating success. For downloads, if distillation was
64 // successful, it will also include the distilled url and extracted title. 66 // successful, it will also include the distilled url and extracted title.
65 URLDownloader( 67 URLDownloader(
66 dom_distiller::DomDistillerService* distiller_service, 68 dom_distiller::DomDistillerService* distiller_service,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 images, 126 images,
125 const std::string& html); 127 const std::string& html);
126 // Callback for distillation completion. 128 // Callback for distillation completion.
127 void DistillerCallback( 129 void DistillerCallback(
128 const GURL& pageURL, 130 const GURL& pageURL,
129 const std::string& html, 131 const std::string& html,
130 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>& 132 const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>&
131 images, 133 images,
132 const std::string& title); 134 const std::string& title);
133 135
136 // A callback called if the URL passed to the distilled led to a 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 original_url_;
148 GURL distilled_url_;
142 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; 149 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_;
143 base::CancelableTaskTracker task_tracker_; 150 base::CancelableTaskTracker task_tracker_;
144 151
145 DISALLOW_COPY_AND_ASSIGN(URLDownloader); 152 DISALLOW_COPY_AND_ASSIGN(URLDownloader);
146 }; 153 };
147 154
148 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ 155 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_download_service.cc ('k') | ios/chrome/browser/reading_list/url_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698