| Index: ios/chrome/browser/reading_list/reading_list_download_service.h
|
| diff --git a/ios/chrome/browser/reading_list/reading_list_download_service.h b/ios/chrome/browser/reading_list/reading_list_download_service.h
|
| index 2c23710615c67cf10098764598db6cb6e984202b..bbe08105a39c7aa736144ddff137a6d60f67d24a 100644
|
| --- a/ios/chrome/browser/reading_list/reading_list_download_service.h
|
| +++ b/ios/chrome/browser/reading_list/reading_list_download_service.h
|
| @@ -9,6 +9,7 @@
|
| #include "components/keyed_service/core/keyed_service.h"
|
| #include "ios/chrome/browser/reading_list/reading_list_model_observer.h"
|
| #include "ios/chrome/browser/reading_list/url_downloader.h"
|
| +#include "net/base/network_change_notifier.h"
|
|
|
| class GURL;
|
| class PrefService;
|
| @@ -25,8 +26,10 @@ class DomDistillerService;
|
| // Any calls made to DownloadAllEntries/DownloadEntry before the model is
|
| // loaded will be ignored. When the model is loaded, DownloadAllEntries will be
|
| // called automatically.
|
| -class ReadingListDownloadService : public KeyedService,
|
| - public ReadingListModelObserver {
|
| +class ReadingListDownloadService
|
| + : public KeyedService,
|
| + public ReadingListModelObserver,
|
| + public net::NetworkChangeNotifier::ConnectionTypeObserver {
|
| public:
|
| ReadingListDownloadService(
|
| ReadingListModel* reading_list_model,
|
| @@ -56,6 +59,18 @@ class ReadingListDownloadService : public KeyedService,
|
| // Tries to save offline versions of all entries in the reading list that are
|
| // not yet saved. Must only be called after reading list model is loaded.
|
| void DownloadAllEntries();
|
| + // Schedule a download of an offline version of the reading list entry,
|
| + // according to the delay of the entry. Must only be called after reading list
|
| + // model is loaded.
|
| + void ScheduleDownloadEntry(const ReadingListEntry& entry);
|
| + // Tries to save an offline version of the reading list entry corresponding to
|
| + // the |url| if it is not yet saved. Must only be called after reading list
|
| + // model is loaded.
|
| + void DownloadEntryFromURL(const GURL& url);
|
| + // Schedule a download of an offline version of the reading list entry
|
| + // associated to this |url|, according to the delay of the entry. Must only be
|
| + // called after reading list model is loaded.
|
| + void ScheduleDownloadEntryFromURL(const GURL& url);
|
| // Tries to save an offline version of the reading list entry if it is not yet
|
| // saved. Must only be called after reading list model is loaded.
|
| void DownloadEntry(const ReadingListEntry& entry);
|
| @@ -71,8 +86,17 @@ class ReadingListDownloadService : public KeyedService,
|
| // Callback for entry deletion.
|
| void OnDeleteEnd(const GURL& url, bool success);
|
|
|
| + // net::NetworkChangeNotifier::ConnectionTypeObserver:
|
| + void OnConnectionTypeChanged(
|
| + net::NetworkChangeNotifier::ConnectionType type) override;
|
| +
|
| ReadingListModel* reading_list_model_;
|
| std::unique_ptr<URLDownloader> url_downloader_;
|
| + std::vector<GURL> url_to_download_cellular_;
|
| + std::vector<GURL> url_to_download_wifi_;
|
| + bool had_connection_;
|
| +
|
| + base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService);
|
| };
|
|
|