| 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 COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 std::vector<std::unique_ptr<SavePageRequest>> /* requests */)> | 31 std::vector<std::unique_ptr<SavePageRequest>> /* requests */)> |
| 32 GetRequestsCallback; | 32 GetRequestsCallback; |
| 33 typedef base::Callback<void(ItemActionStatus)> AddCallback; | 33 typedef base::Callback<void(ItemActionStatus)> AddCallback; |
| 34 typedef base::Callback<void(bool /* success */)> ResetCallback; | 34 typedef base::Callback<void(bool /* success */)> ResetCallback; |
| 35 | 35 |
| 36 virtual ~RequestQueueStore(){}; | 36 virtual ~RequestQueueStore(){}; |
| 37 | 37 |
| 38 // Gets all of the requests from the store. | 38 // Gets all of the requests from the store. |
| 39 virtual void GetRequests(const GetRequestsCallback& callback) = 0; | 39 virtual void GetRequests(const GetRequestsCallback& callback) = 0; |
| 40 | 40 |
| 41 // Gets requests with specified IDs from the store. UpdateCallback is used |
| 42 // instead of GetRequestsCallback to indicate which requests where not found. |
| 43 virtual void GetRequestsByIds(const std::vector<int64_t>& request_ids, |
| 44 const UpdateCallback& callback) = 0; |
| 45 |
| 41 // Asynchronously adds request in store. Fails if request with the same | 46 // Asynchronously adds request in store. Fails if request with the same |
| 42 // offline ID already exists. | 47 // offline ID already exists. |
| 43 virtual void AddRequest(const SavePageRequest& offline_page, | 48 virtual void AddRequest(const SavePageRequest& offline_page, |
| 44 const AddCallback& callback) = 0; | 49 const AddCallback& callback) = 0; |
| 45 | 50 |
| 46 // Asynchronously updates requests in store. | 51 // Asynchronously updates requests in store. |
| 47 virtual void UpdateRequests(const std::vector<SavePageRequest>& requests, | 52 virtual void UpdateRequests(const std::vector<SavePageRequest>& requests, |
| 48 const UpdateCallback& callback) = 0; | 53 const UpdateCallback& callback) = 0; |
| 49 | 54 |
| 50 // Asynchronously removes requests from the store using their IDs. | 55 // Asynchronously removes requests from the store using their IDs. |
| 51 // Result of the update, and a number of removed pages is passed in the | 56 // Result of the update, and a number of removed pages is passed in the |
| 52 // callback. | 57 // callback. |
| 53 // Result of remove should be false, when one of the provided items couldn't | 58 // Result of remove should be false, when one of the provided items couldn't |
| 54 // be deleted, e.g. because it was missing. | 59 // be deleted, e.g. because it was missing. |
| 55 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, | 60 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, |
| 56 const UpdateCallback& callback) = 0; | 61 const UpdateCallback& callback) = 0; |
| 57 | 62 |
| 58 // Resets the store. | 63 // Resets the store. |
| 59 virtual void Reset(const ResetCallback& callback) = 0; | 64 virtual void Reset(const ResetCallback& callback) = 0; |
| 60 | 65 |
| 61 // Gets the store state. | 66 // Gets the store state. |
| 62 virtual StoreState state() const = 0; | 67 virtual StoreState state() const = 0; |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 } // namespace offline_pages | 70 } // namespace offline_pages |
| 66 | 71 |
| 67 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | 72 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ |
| OLD | NEW |