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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Returns zero or one offline pages associated with a specified |offline_id|. | 134 // Returns zero or one offline pages associated with a specified |offline_id|. |
135 virtual void GetPageByOfflineId( | 135 virtual void GetPageByOfflineId( |
136 int64_t offline_id, | 136 int64_t offline_id, |
137 const SingleOfflinePageItemCallback& callback) = 0; | 137 const SingleOfflinePageItemCallback& callback) = 0; |
138 | 138 |
139 // Returns an offline page associated with a specified |offline_id|. nullptr | 139 // Returns an offline page associated with a specified |offline_id|. nullptr |
140 // is returned if not found. | 140 // is returned if not found. |
141 virtual const OfflinePageItem* MaybeGetPageByOfflineId( | 141 virtual const OfflinePageItem* MaybeGetPageByOfflineId( |
142 int64_t offline_id) const = 0; | 142 int64_t offline_id) const = 0; |
143 | 143 |
144 // Returns the offline page that is stored under |offline_url|, if any. | |
145 virtual void GetPageByOfflineURL( | |
146 const GURL& offline_url, | |
147 const SingleOfflinePageItemCallback& callback) = 0; | |
148 | |
149 // Returns an offline page that is stored as |offline_url|. A nullptr is | |
150 // returned if not found. | |
151 // | |
152 // This function is deprecated, and may return |nullptr| even if a page | |
153 // exists, depending on the implementation details of OfflinePageModel. | |
154 // Use |GetPageByOfflineURL| instead. | |
155 virtual const OfflinePageItem* MaybeGetPageByOfflineURL( | |
156 const GURL& offline_url) const = 0; | |
157 | |
158 // Returns the offline pages that are stored under |online_url|. | 144 // Returns the offline pages that are stored under |online_url|. |
159 virtual void GetPagesByOnlineURL( | 145 virtual void GetPagesByOnlineURL( |
160 const GURL& online_url, | 146 const GURL& online_url, |
161 const MultipleOfflinePageItemCallback& callback) = 0; | 147 const MultipleOfflinePageItemCallback& callback) = 0; |
162 | 148 |
163 // Returns an offline page saved for |online_url|. A nullptr is returned if | 149 // Returns an offline page saved for |online_url|. A nullptr is returned if |
164 // not found. See |GetBestPageForOnlineURL| for selection criteria. | 150 // not found. See |GetBestPageForOnlineURL| for selection criteria. |
165 virtual const OfflinePageItem* MaybeGetBestPageForOnlineURL( | 151 virtual const OfflinePageItem* MaybeGetBestPageForOnlineURL( |
166 const GURL& online_url) const = 0; | 152 const GURL& online_url) const = 0; |
167 | 153 |
168 // Marks pages with |offline_ids| as expired and deletes the associated | 154 // Marks pages with |offline_ids| as expired and deletes the associated |
169 // archive files. | 155 // archive files. |
170 virtual void ExpirePages(const std::vector<int64_t>& offline_ids, | 156 virtual void ExpirePages(const std::vector<int64_t>& offline_ids, |
171 const base::Time& expiration_time, | 157 const base::Time& expiration_time, |
172 const base::Callback<void(bool)>& callback) = 0; | 158 const base::Callback<void(bool)>& callback) = 0; |
173 | 159 |
174 // Returns the policy controller. | 160 // Returns the policy controller. |
175 virtual ClientPolicyController* GetPolicyController() = 0; | 161 virtual ClientPolicyController* GetPolicyController() = 0; |
176 | 162 |
177 // TODO(dougarnett): Remove this and its uses. | 163 // TODO(dougarnett): Remove this and its uses. |
178 virtual bool is_loaded() const = 0; | 164 virtual bool is_loaded() const = 0; |
179 | 165 |
180 // Returns the logger. Ownership is retained by the model. | 166 // Returns the logger. Ownership is retained by the model. |
181 virtual OfflineEventLogger* GetLogger() = 0; | 167 virtual OfflineEventLogger* GetLogger() = 0; |
182 }; | 168 }; |
183 | 169 |
184 } // namespace offline_pages | 170 } // namespace offline_pages |
185 | 171 |
186 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ | 172 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ |
OLD | NEW |