Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 | |
| 13 namespace offline_pages { | |
| 14 | |
| 15 class SavePageRequest; | |
| 16 | |
| 17 // Interface for classes storing save page requests. | |
| 18 class RequestQueueStore { | |
| 19 public: | |
| 20 typedef base::Callback<void(bool, const std::vector<SavePageRequest>&)> | |
| 21 GetRequestsCallback; | |
| 22 typedef base::Callback<void(bool)> UpdateCallback; | |
| 23 typedef base::Callback<void(bool)> ResetCallback; | |
| 24 | |
| 25 virtual ~RequestQueueStore(){}; | |
| 26 | |
| 27 // Gets all of the requests from the store. | |
| 28 virtual void GetRequests(const GetRequestsCallback& callback) = 0; | |
|
Pete Williamson
2016/05/03 20:38:52
Why make this async again? (Sorry if I already as
fgorski
2016/05/03 21:50:21
You know we need to read these from the drive eith
Pete Williamson
2016/05/03 22:00:25
Ah yes, that was why. This is OK as is.
| |
| 29 | |
| 30 // Asynchronously adds or updates request in store. | |
| 31 // Result of the update is passed in the callback. | |
| 32 virtual void AddOrUpdateRequest(const SavePageRequest& request, | |
| 33 const UpdateCallback& callback) = 0; | |
| 34 | |
| 35 // Asynchronously removes requests from the store using their IDs. | |
| 36 // Result of the update is passed in the callback. | |
|
Pete Williamson
2016/05/03 20:38:52
Let's be a bit more specific - returns true if any
fgorski
2016/05/03 21:50:21
Done.
| |
| 37 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, | |
| 38 const UpdateCallback& callback) = 0; | |
| 39 | |
| 40 // Resets the store. | |
| 41 virtual void Reset(const ResetCallback& callback) = 0; | |
| 42 }; | |
| 43 | |
| 44 } // namespace offline_pages | |
| 45 | |
| 46 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | |
| OLD | NEW |