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

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_download_service.cc

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 #include "ios/chrome/browser/reading_list/reading_list_download_service.h" 5 #include "ios/chrome/browser/reading_list/reading_list_download_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 24 matching lines...) Expand all
35 // Number of time the download must fail before the download occurs only in 35 // Number of time the download must fail before the download occurs only in
36 // wifi. 36 // wifi.
37 const int kNumberOfFailsBeforeWifiOnly = 5; 37 const int kNumberOfFailsBeforeWifiOnly = 5;
38 // Number of time the download must fail before we give up trying to download 38 // Number of time the download must fail before we give up trying to download
39 // it. 39 // it.
40 const int kNumberOfFailsBeforeStop = 7; 40 const int kNumberOfFailsBeforeStop = 7;
41 } // namespace 41 } // namespace
42 42
43 ReadingListDownloadService::ReadingListDownloadService( 43 ReadingListDownloadService::ReadingListDownloadService(
44 ReadingListModel* reading_list_model, 44 ReadingListModel* reading_list_model,
45 dom_distiller::DomDistillerService* distiller_service,
46 PrefService* prefs, 45 PrefService* prefs,
47 base::FilePath chrome_profile_path, 46 base::FilePath chrome_profile_path,
48 net::URLRequestContextGetter* url_request_context_getter, 47 net::URLRequestContextGetter* url_request_context_getter,
48 std::unique_ptr<dom_distiller::DistillerFactory> distiller_factory,
49 std::unique_ptr<reading_list::ReadingListDistillerPageFactory> 49 std::unique_ptr<reading_list::ReadingListDistillerPageFactory>
50 distiller_page_factory) 50 distiller_page_factory)
51 : reading_list_model_(reading_list_model), 51 : reading_list_model_(reading_list_model),
52 chrome_profile_path_(chrome_profile_path), 52 chrome_profile_path_(chrome_profile_path),
53 had_connection_(!net::NetworkChangeNotifier::IsOffline()), 53 had_connection_(!net::NetworkChangeNotifier::IsOffline()),
54 distiller_page_factory_(std::move(distiller_page_factory)), 54 distiller_page_factory_(std::move(distiller_page_factory)),
55 distiller_factory_(std::move(distiller_factory)),
55 weak_ptr_factory_(this) { 56 weak_ptr_factory_(this) {
56 DCHECK(reading_list_model); 57 DCHECK(reading_list_model);
57 58
58 url_downloader_ = base::MakeUnique<URLDownloader>( 59 url_downloader_ = base::MakeUnique<URLDownloader>(
59 distiller_service, distiller_page_factory_.get(), prefs, 60 distiller_factory_.get(), distiller_page_factory_.get(), prefs,
60 chrome_profile_path, url_request_context_getter, 61 chrome_profile_path, url_request_context_getter,
61 base::Bind(&ReadingListDownloadService::OnDownloadEnd, 62 base::Bind(&ReadingListDownloadService::OnDownloadEnd,
62 base::Unretained(this)), 63 base::Unretained(this)),
63 base::Bind(&ReadingListDownloadService::OnDeleteEnd, 64 base::Bind(&ReadingListDownloadService::OnDeleteEnd,
64 base::Unretained(this))); 65 base::Unretained(this)));
65 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 66 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
66 } 67 }
67 68
68 ReadingListDownloadService::~ReadingListDownloadService() { 69 ReadingListDownloadService::~ReadingListDownloadService() {
69 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 70 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 for (auto& url : url_to_download_cellular_) { 288 for (auto& url : url_to_download_cellular_) {
288 ScheduleDownloadEntry(url); 289 ScheduleDownloadEntry(url);
289 } 290 }
290 } 291 }
291 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { 292 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) {
292 for (auto& url : url_to_download_wifi_) { 293 for (auto& url : url_to_download_wifi_) {
293 ScheduleDownloadEntry(url); 294 ScheduleDownloadEntry(url);
294 } 295 }
295 } 296 }
296 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698