| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Returns true if saving an offline page may be attempted for |url|. | 75 // Returns true if saving an offline page may be attempted for |url|. |
| 76 static bool CanSaveURL(const GURL& url); | 76 static bool CanSaveURL(const GURL& url); |
| 77 | 77 |
| 78 OfflinePageModel(); | 78 OfflinePageModel(); |
| 79 ~OfflinePageModel() override; | 79 ~OfflinePageModel() override; |
| 80 | 80 |
| 81 virtual void AddObserver(Observer* observer) = 0; | 81 virtual void AddObserver(Observer* observer) = 0; |
| 82 virtual void RemoveObserver(Observer* observer) = 0; | 82 virtual void RemoveObserver(Observer* observer) = 0; |
| 83 | 83 |
| 84 // Attempts to save a page addressed by |url| offline. Requires that the model | 84 // Attempts to save a page addressed by |url| offline. Requires that the model |
| 85 // is loaded. Generates a new offline id and returns it. | 85 // is loaded. Generates a new offline id and returns |
| 86 // it. |proposed_offline_id| is used for the offline_id for the saved file if |
| 87 // it is non-zero. If it is zero, a new, random ID will be generated. |
| 86 virtual void SavePage(const GURL& url, | 88 virtual void SavePage(const GURL& url, |
| 87 const ClientId& client_id, | 89 const ClientId& client_id, |
| 90 int64_t proposed_offline_id, |
| 88 std::unique_ptr<OfflinePageArchiver> archiver, | 91 std::unique_ptr<OfflinePageArchiver> archiver, |
| 89 const SavePageCallback& callback) = 0; | 92 const SavePageCallback& callback) = 0; |
| 90 | 93 |
| 91 // Marks that the offline page related to the passed |offline_id| has been | 94 // Marks that the offline page related to the passed |offline_id| has been |
| 92 // accessed. Its access info, including last access time and access count, | 95 // accessed. Its access info, including last access time and access count, |
| 93 // will be updated. Requires that the model is loaded. | 96 // will be updated. Requires that the model is loaded. |
| 94 virtual void MarkPageAccessed(int64_t offline_id) = 0; | 97 virtual void MarkPageAccessed(int64_t offline_id) = 0; |
| 95 | 98 |
| 96 // Wipes out all the data by deleting all saved files and clearing the store. | 99 // Wipes out all the data by deleting all saved files and clearing the store. |
| 97 virtual void ClearAll(const base::Closure& callback) = 0; | 100 virtual void ClearAll(const base::Closure& callback) = 0; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // TODO(dougarnett): Remove this and its uses. | 192 // TODO(dougarnett): Remove this and its uses. |
| 190 virtual bool is_loaded() const = 0; | 193 virtual bool is_loaded() const = 0; |
| 191 | 194 |
| 192 // Returns the logger. Ownership is retained by the model. | 195 // Returns the logger. Ownership is retained by the model. |
| 193 virtual OfflineEventLogger* GetLogger() = 0; | 196 virtual OfflineEventLogger* GetLogger() = 0; |
| 194 }; | 197 }; |
| 195 | 198 |
| 196 } // namespace offline_pages | 199 } // namespace offline_pages |
| 197 | 200 |
| 198 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 201 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |