| 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_READING_LIST_DOWNLOAD_SERVICE_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ |
| 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/keyed_service/core/keyed_service.h" | 9 #include "components/keyed_service/core/keyed_service.h" |
| 10 #include "components/reading_list/ios/reading_list_model_observer.h" | 10 #include "components/reading_list/ios/reading_list_model_observer.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // model is loaded. | 74 // model is loaded. |
| 75 void ScheduleDownloadEntry(const GURL& url); | 75 void ScheduleDownloadEntry(const GURL& url); |
| 76 // Tries to save an offline version of the reading list entry if it is not yet | 76 // Tries to save an offline version of the reading list entry if it is not yet |
| 77 // saved. Must only be called after reading list model is loaded. | 77 // saved. Must only be called after reading list model is loaded. |
| 78 void DownloadEntry(const GURL& url); | 78 void DownloadEntry(const GURL& url); |
| 79 // Removes the offline version of the reading list entry if it exists. Must | 79 // Removes the offline version of the reading list entry if it exists. Must |
| 80 // only be called after reading list model is loaded. | 80 // only be called after reading list model is loaded. |
| 81 void RemoveDownloadedEntry(const GURL& url); | 81 void RemoveDownloadedEntry(const GURL& url); |
| 82 // Callback for entry download. | 82 // Callback for entry download. |
| 83 void OnDownloadEnd(const GURL& url, | 83 void OnDownloadEnd(const GURL& url, |
| 84 const GURL& distilled_url, |
| 84 URLDownloader::SuccessState success, | 85 URLDownloader::SuccessState success, |
| 85 const base::FilePath& distilled_path, | 86 const base::FilePath& distilled_path, |
| 86 const std::string& title); | 87 const std::string& title); |
| 87 | 88 |
| 88 // Callback for entry deletion. | 89 // Callback for entry deletion. |
| 89 void OnDeleteEnd(const GURL& url, bool success); | 90 void OnDeleteEnd(const GURL& url, bool success); |
| 90 | 91 |
| 91 // net::NetworkChangeNotifier::ConnectionTypeObserver: | 92 // net::NetworkChangeNotifier::ConnectionTypeObserver: |
| 92 void OnConnectionTypeChanged( | 93 void OnConnectionTypeChanged( |
| 93 net::NetworkChangeNotifier::ConnectionType type) override; | 94 net::NetworkChangeNotifier::ConnectionType type) override; |
| 94 | 95 |
| 95 ReadingListModel* reading_list_model_; | 96 ReadingListModel* reading_list_model_; |
| 96 base::FilePath chrome_profile_path_; | 97 base::FilePath chrome_profile_path_; |
| 97 std::unique_ptr<URLDownloader> url_downloader_; | 98 std::unique_ptr<URLDownloader> url_downloader_; |
| 98 std::vector<GURL> url_to_download_cellular_; | 99 std::vector<GURL> url_to_download_cellular_; |
| 99 std::vector<GURL> url_to_download_wifi_; | 100 std::vector<GURL> url_to_download_wifi_; |
| 100 bool had_connection_; | 101 bool had_connection_; |
| 101 std::unique_ptr<reading_list::ReadingListDistillerPageFactory> | 102 std::unique_ptr<reading_list::ReadingListDistillerPageFactory> |
| 102 distiller_page_factory_; | 103 distiller_page_factory_; |
| 103 | 104 |
| 104 base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_; | 105 base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_; |
| 105 | 106 |
| 106 DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService); | 107 DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService); |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ | 110 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ |
| OLD | NEW |