| 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 13 matching lines...) Expand all Loading... |
| 24 FAILED, // Add or update attempt failed. | 24 FAILED, // Add or update attempt failed. |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 using UpdateCallback = RequestQueue::UpdateCallback; | 27 using UpdateCallback = RequestQueue::UpdateCallback; |
| 28 | 28 |
| 29 typedef base::Callback<void( | 29 typedef base::Callback<void( |
| 30 bool /* success */, | 30 bool /* success */, |
| 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( | |
| 35 const RequestQueue::UpdateMultipleRequestResults& /* statuses */, | |
| 36 std::vector<std::unique_ptr<SavePageRequest>> /* requests */)> | |
| 37 RemoveCallback; | |
| 38 typedef base::Callback<void(bool /* success */)> ResetCallback; | 34 typedef base::Callback<void(bool /* success */)> ResetCallback; |
| 39 | 35 |
| 40 virtual ~RequestQueueStore(){}; | 36 virtual ~RequestQueueStore(){}; |
| 41 | 37 |
| 42 // Gets all of the requests from the store. | 38 // Gets all of the requests from the store. |
| 43 virtual void GetRequests(const GetRequestsCallback& callback) = 0; | 39 virtual void GetRequests(const GetRequestsCallback& callback) = 0; |
| 44 | 40 |
| 45 // Asynchronously adds request in store. Fails if request with the same | 41 // Asynchronously adds request in store. Fails if request with the same |
| 46 // offline ID already exists. | 42 // offline ID already exists. |
| 47 virtual void AddRequest(const SavePageRequest& offline_page, | 43 virtual void AddRequest(const SavePageRequest& offline_page, |
| 48 const AddCallback& callback) = 0; | 44 const AddCallback& callback) = 0; |
| 49 | 45 |
| 50 // Asynchronously updates requests in store. | 46 // Asynchronously updates requests in store. |
| 51 virtual void UpdateRequests(const std::vector<SavePageRequest>& requests, | 47 virtual void UpdateRequests(const std::vector<SavePageRequest>& requests, |
| 52 const UpdateCallback& callback) = 0; | 48 const UpdateCallback& callback) = 0; |
| 53 | 49 |
| 54 // Asynchronously removes requests from the store using their IDs. | 50 // Asynchronously removes requests from the store using their IDs. |
| 55 // Result of the update, and a number of removed pages is passed in the | 51 // Result of the update, and a number of removed pages is passed in the |
| 56 // callback. | 52 // callback. |
| 57 // Result of remove should be false, when one of the provided items couldn't | 53 // Result of remove should be false, when one of the provided items couldn't |
| 58 // be deleted, e.g. because it was missing. | 54 // be deleted, e.g. because it was missing. |
| 59 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, | 55 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, |
| 60 const RemoveCallback& callback) = 0; | 56 const UpdateCallback& callback) = 0; |
| 61 | 57 |
| 62 // Resets the store. | 58 // Resets the store. |
| 63 virtual void Reset(const ResetCallback& callback) = 0; | 59 virtual void Reset(const ResetCallback& callback) = 0; |
| 64 | 60 |
| 65 // Gets the store state. | 61 // Gets the store state. |
| 66 virtual StoreState state() const = 0; | 62 virtual StoreState state() const = 0; |
| 67 }; | 63 }; |
| 68 | 64 |
| 69 } // namespace offline_pages | 65 } // namespace offline_pages |
| 70 | 66 |
| 71 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | 67 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ |
| OLD | NEW |