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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ReadingListWillRemoveEntry(const ReadingListModel* model, | 49 void ReadingListWillRemoveEntry(const ReadingListModel* model, |
50 const GURL& url) override; | 50 const GURL& url) override; |
51 void ReadingListDidAddEntry(const ReadingListModel* model, | 51 void ReadingListDidAddEntry(const ReadingListModel* model, |
52 const GURL& url) override; | 52 const GURL& url) override; |
| 53 void ReadingListDidMoveEntry(const ReadingListModel* model, |
| 54 const GURL& url) override; |
53 | 55 |
54 private: | 56 private: |
55 // Tries to save offline versions of all entries in the reading list that are | 57 // Tries to save offline versions of all entries in the reading list that are |
56 // not yet saved. Must only be called after reading list model is loaded. | 58 // not yet saved. Must only be called after reading list model is loaded. |
57 void DownloadAllEntries(); | 59 void DownloadAllEntries(); |
| 60 // Processes a new entry and schedule a download if needed. |
| 61 void ProcessNewEntry(const GURL& url); |
58 // Schedule a download of an offline version of the reading list entry, | 62 // Schedule a download of an offline version of the reading list entry, |
59 // according to the delay of the entry. Must only be called after reading list | 63 // according to the delay of the entry. Must only be called after reading list |
60 // model is loaded. | 64 // model is loaded. |
61 void ScheduleDownloadEntry(const GURL& url); | 65 void ScheduleDownloadEntry(const GURL& url); |
62 // Tries to save an offline version of the reading list entry if it is not yet | 66 // Tries to save an offline version of the reading list entry if it is not yet |
63 // saved. Must only be called after reading list model is loaded. | 67 // saved. Must only be called after reading list model is loaded. |
64 void DownloadEntry(const GURL& url); | 68 void DownloadEntry(const GURL& url); |
65 // Removes the offline version of the reading list entry if it exists. Must | 69 // Removes the offline version of the reading list entry if it exists. Must |
66 // only be called after reading list model is loaded. | 70 // only be called after reading list model is loaded. |
67 void RemoveDownloadedEntry(const GURL& url); | 71 void RemoveDownloadedEntry(const GURL& url); |
(...skipping 15 matching lines...) Expand all Loading... |
83 std::vector<GURL> url_to_download_cellular_; | 87 std::vector<GURL> url_to_download_cellular_; |
84 std::vector<GURL> url_to_download_wifi_; | 88 std::vector<GURL> url_to_download_wifi_; |
85 bool had_connection_; | 89 bool had_connection_; |
86 | 90 |
87 base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_; | 91 base::WeakPtrFactory<ReadingListDownloadService> weak_ptr_factory_; |
88 | 92 |
89 DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService); | 93 DISALLOW_COPY_AND_ASSIGN(ReadingListDownloadService); |
90 }; | 94 }; |
91 | 95 |
92 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ | 96 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DOWNLOAD_SERVICE_H_ |
OLD | NEW |