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

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

Issue 2666643002: Remove usage of DomDistillerService in ReadingListDownloadService. (Closed)
Patch Set: feedback Created 3 years, 10 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"
11 #include "base/task/cancelable_task_tracker.h" 11 #include "base/task/cancelable_task_tracker.h"
12 #include "ios/chrome/browser/dom_distiller/distiller_viewer.h" 12 #include "ios/chrome/browser/dom_distiller/distiller_viewer.h"
13 #include "ios/chrome/browser/reading_list/reading_list_distiller_page.h" 13 #include "ios/chrome/browser/reading_list/reading_list_distiller_page.h"
14 14
15 class PrefService; 15 class PrefService;
16 class GURL; 16 class GURL;
17 namespace base { 17 namespace base {
18 class FilePath; 18 class FilePath;
19 } 19 }
20 20
21 namespace dom_distiller {
22 class DomDistillerService;
23 }
24
25 namespace net { 21 namespace net {
26 class URLFetcher; 22 class URLFetcher;
27 class URLRequestContextGetter; 23 class URLRequestContextGetter;
28 } 24 }
29 25
30 namespace reading_list { 26 namespace reading_list {
31 class ReadingListDistillerPageFactory; 27 class ReadingListDistillerPageFactory;
32 } 28 }
33 29
34 // This class downloads and deletes offline versions of URLs. 30 // This class downloads and deletes offline versions of URLs.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const GURL&, 71 const GURL&,
76 SuccessState, 72 SuccessState,
77 const base::FilePath&, 73 const base::FilePath&,
78 const std::string&)>; 74 const std::string&)>;
79 75
80 // Create a URL downloader with completion callbacks for downloads and 76 // Create a URL downloader with completion callbacks for downloads and
81 // deletions. The completion callbacks will be called with the original url 77 // deletions. The completion callbacks will be called with the original url
82 // and a boolean indicating success. For downloads, if distillation was 78 // and a boolean indicating success. For downloads, if distillation was
83 // successful, it will also include the distilled url and extracted title. 79 // successful, it will also include the distilled url and extracted title.
84 URLDownloader( 80 URLDownloader(
85 dom_distiller::DomDistillerService* distiller_service, 81 dom_distiller::DistillerFactory* distiller_factory,
86 reading_list::ReadingListDistillerPageFactory* distiller_page_factory, 82 reading_list::ReadingListDistillerPageFactory* distiller_page_factory,
87 PrefService* prefs, 83 PrefService* prefs,
88 base::FilePath chrome_profile_path, 84 base::FilePath chrome_profile_path,
89 net::URLRequestContextGetter* url_request_context_getter, 85 net::URLRequestContextGetter* url_request_context_getter,
90 const DownloadCompletion& download_completion, 86 const DownloadCompletion& download_completion,
91 const SuccessCompletion& delete_completion); 87 const SuccessCompletion& delete_completion);
92 ~URLDownloader() override; 88 ~URLDownloader() override;
93 89
94 // Asynchronously download an offline version of the URL. 90 // Asynchronously download an offline version of the URL.
95 void DownloadOfflineURL(const GURL& url); 91 void DownloadOfflineURL(const GURL& url);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 const std::string& title); 166 const std::string& title);
171 167
172 // PDF processing methods 168 // PDF processing methods
173 169
174 // Starts fetching the PDF file. If |original_url_| triggered a redirection, 170 // Starts fetching the PDF file. If |original_url_| triggered a redirection,
175 // directly save |distilled_url_|. 171 // directly save |distilled_url_|.
176 virtual void FetchPDFFile(); 172 virtual void FetchPDFFile();
177 // Saves the file downloaded by |fetcher_|. Creates the directory if needed. 173 // Saves the file downloaded by |fetcher_|. Creates the directory if needed.
178 SuccessState SavePDFFile(const base::FilePath& temporary_path); 174 SuccessState SavePDFFile(const base::FilePath& temporary_path);
179 175
180 dom_distiller::DomDistillerService* distiller_service_;
181 reading_list::ReadingListDistillerPageFactory* distiller_page_factory_; 176 reading_list::ReadingListDistillerPageFactory* distiller_page_factory_;
177 dom_distiller::DistillerFactory* distiller_factory_;
182 PrefService* pref_service_; 178 PrefService* pref_service_;
183 const DownloadCompletion download_completion_; 179 const DownloadCompletion download_completion_;
184 const SuccessCompletion delete_completion_; 180 const SuccessCompletion delete_completion_;
181
185 std::deque<Task> tasks_; 182 std::deque<Task> tasks_;
186 bool working_; 183 bool working_;
187 base::FilePath base_directory_; 184 base::FilePath base_directory_;
188 GURL original_url_; 185 GURL original_url_;
189 GURL distilled_url_; 186 GURL distilled_url_;
190 std::string mime_type_; 187 std::string mime_type_;
191 // Fetcher used to redownload the document and save it in the sandbox. 188 // Fetcher used to redownload the document and save it in the sandbox.
192 std::unique_ptr<net::URLFetcher> fetcher_; 189 std::unique_ptr<net::URLFetcher> fetcher_;
193 // URLRequestContextGetter needed for the URLFetcher. 190 // URLRequestContextGetter needed for the URLFetcher.
194 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 191 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
195 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_; 192 std::unique_ptr<dom_distiller::DistillerViewerInterface> distiller_;
196 base::CancelableTaskTracker task_tracker_; 193 base::CancelableTaskTracker task_tracker_;
197 194
198 DISALLOW_COPY_AND_ASSIGN(URLDownloader); 195 DISALLOW_COPY_AND_ASSIGN(URLDownloader);
199 }; 196 };
200 197
201 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_ 198 #endif // IOS_CHROME_BROWSER_READING_LIST_URL_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698