| 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 "ios/chrome/browser/reading_list/reading_list_model_observer.h" | 10 #include "ios/chrome/browser/reading_list/reading_list_model_observer.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ~ReadingListDownloadService() override; | 39 ~ReadingListDownloadService() override; |
| 40 | 40 |
| 41 // Initializes the reading list download service. | 41 // Initializes the reading list download service. |
| 42 void Initialize(); | 42 void Initialize(); |
| 43 | 43 |
| 44 // KeyedService implementation. | 44 // KeyedService implementation. |
| 45 void Shutdown() override; | 45 void Shutdown() override; |
| 46 | 46 |
| 47 // ReadingListModelObserver implementation | 47 // ReadingListModelObserver implementation |
| 48 void ReadingListModelLoaded(const ReadingListModel* model) override; | 48 void ReadingListModelLoaded(const ReadingListModel* model) override; |
| 49 void ReadingListWillRemoveReadEntry(const ReadingListModel* model, | 49 void ReadingListWillRemoveEntry(const ReadingListModel* model, |
| 50 size_t index) override; | 50 const GURL& url) override; |
| 51 void ReadingListWillRemoveUnreadEntry(const ReadingListModel* model, | 51 void ReadingListWillAddEntry(const ReadingListModel* model, |
| 52 size_t index) override; | 52 const ReadingListEntry& entry) override; |
| 53 void ReadingListWillAddUnreadEntry(const ReadingListModel* model, | |
| 54 const ReadingListEntry& entry) override; | |
| 55 void ReadingListWillAddReadEntry(const ReadingListModel* model, | |
| 56 const ReadingListEntry& entry) override; | |
| 57 | 53 |
| 58 private: | 54 private: |
| 59 // Tries to save offline versions of all entries in the reading list that are | 55 // Tries to save offline versions of all entries in the reading list that are |
| 60 // not yet saved. Must only be called after reading list model is loaded. | 56 // not yet saved. Must only be called after reading list model is loaded. |
| 61 void DownloadAllEntries(); | 57 void DownloadAllEntries(); |
| 62 // Schedule a download of an offline version of the reading list entry, | 58 // Schedule a download of an offline version of the reading list entry, |
| 63 // according to the delay of the entry. Must only be called after reading list | 59 // according to the delay of the entry. Must only be called after reading list |
| 64 // model is loaded. | 60 // model is loaded. |
| 65 void ScheduleDownloadEntry(const ReadingListEntry& entry); | 61 void ScheduleDownloadEntry(const ReadingListEntry& entry); |
| 66 // Tries to save an offline version of the reading list entry corresponding to | 62 // Tries to save an offline version of the reading list entry corresponding to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 95 std::vector<GURL> url_to_download_cellular_; | 91 std::vector<GURL> url_to_download_cellular_; |
| 96 std::vector<GURL> url_to_download_wifi_; | 92 std::vector<GURL> url_to_download_wifi_; |
| 97 bool had_connection_; | 93 bool had_connection_; |
| 98 | 94 |
| 99 base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_; | 95 base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_; |
| 100 | 96 |
| 101 DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService); | 97 DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService); |
| 102 }; | 98 }; |
| 103 | 99 |
| 104 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ | 100 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ |
| OLD | NEW |