Chromium Code Reviews| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "components/offline_pages/offline_page_item.h" | |
| 12 | 13 |
| 13 namespace offline_pages { | 14 namespace offline_pages { |
| 14 | 15 |
| 15 class SavePageRequest; | 16 class SavePageRequest; |
| 16 | 17 |
| 17 // Interface for classes storing save page requests. | 18 // Interface for classes storing save page requests. |
| 18 class RequestQueueStore { | 19 class RequestQueueStore { |
| 19 public: | 20 public: |
| 20 enum class UpdateStatus { | 21 enum class UpdateStatus { |
| 21 ADDED, // Request was added successfully. | 22 ADDED, // Request was added successfully. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 41 // Asynchronously adds or updates request in store. | 42 // Asynchronously adds or updates request in store. |
| 42 // Result of the update is passed in the callback. | 43 // Result of the update is passed in the callback. |
| 43 virtual void AddOrUpdateRequest(const SavePageRequest& request, | 44 virtual void AddOrUpdateRequest(const SavePageRequest& request, |
| 44 const UpdateCallback& callback) = 0; | 45 const UpdateCallback& callback) = 0; |
| 45 | 46 |
| 46 // Asynchronously removes requests from the store using their IDs. | 47 // Asynchronously removes requests from the store using their IDs. |
| 47 // Result of the update, and a number of removed pages is passed in the | 48 // Result of the update, and a number of removed pages is passed in the |
| 48 // callback. | 49 // callback. |
| 49 // Result of remove should be false, when one of the provided items couldn't | 50 // Result of remove should be false, when one of the provided items couldn't |
| 50 // be deleted, e.g. because it was missing. | 51 // be deleted, e.g. because it was missing. |
| 51 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, | 52 virtual void RemoveRequests(const std::vector<int64_t>& request_ids, |
|
fgorski
2016/08/02 05:01:22
thought: should we rename this to RemoveRequestBy
Pete Williamson
2016/08/02 23:27:17
I think it is not being used, and I should just re
fgorski
2016/08/03 03:29:41
Acknowledged.
| |
| 52 const RemoveCallback& callback) = 0; | 53 const RemoveCallback& callback) = 0; |
| 53 | 54 |
| 55 // Asynchronously removes requests from the store using their ClientIds. | |
| 56 // Result of the update, and a number of removed pages is passed in the | |
| 57 // callback. Result of remove should be false, when one of the provided items | |
| 58 // couldn't be deleted, e.g. because it was missing. In case client_ids is | |
| 59 // empty, though this will return true, but the count of deleted pages will be | |
| 60 // 0. | |
| 61 virtual void RemoveRequestsByClientId(const std::vector<ClientId>& client_ids, | |
| 62 const RemoveCallback& callback) = 0; | |
| 63 | |
| 54 // Resets the store. | 64 // Resets the store. |
| 55 virtual void Reset(const ResetCallback& callback) = 0; | 65 virtual void Reset(const ResetCallback& callback) = 0; |
| 56 }; | 66 }; |
| 57 | 67 |
| 58 } // namespace offline_pages | 68 } // namespace offline_pages |
| 59 | 69 |
| 60 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | 70 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ |
| OLD | NEW |