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/background/save_page_request.h" | |
| 12 #include "components/offline_pages/offline_page_item.h" | 13 #include "components/offline_pages/offline_page_item.h" |
| 13 | 14 |
| 14 namespace offline_pages { | 15 namespace offline_pages { |
| 15 | 16 |
| 16 class SavePageRequest; | 17 class SavePageRequest; |
|
fgorski
2016/08/10 16:00:09
remove, please.
Pete Williamson
2016/08/10 21:38:00
Done.
| |
| 17 | 18 |
| 18 // Interface for classes storing save page requests. | 19 // Interface for classes storing save page requests. |
| 19 class RequestQueueStore { | 20 class RequestQueueStore { |
| 20 public: | 21 public: |
| 21 enum class UpdateStatus { | 22 enum class UpdateStatus { |
| 22 ADDED, // Request was added successfully. | 23 ADDED, // Request was added successfully. |
| 23 UPDATED, // Request was updated successfully. | 24 UPDATED, // Request was updated successfully. |
| 24 FAILED, // Add or update attempt failed. | 25 FAILED, // Add or update attempt failed. |
| 25 }; | 26 }; |
| 26 | 27 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 54 | 55 |
| 55 // Asynchronously removes requests from the store using their ClientIds. | 56 // 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 // 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 // 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 // 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 // empty, though this will return true, but the count of deleted pages will be |
| 60 // 0. | 61 // 0. |
| 61 virtual void RemoveRequestsByClientId(const std::vector<ClientId>& client_ids, | 62 virtual void RemoveRequestsByClientId(const std::vector<ClientId>& client_ids, |
| 62 const RemoveCallback& callback) = 0; | 63 const RemoveCallback& callback) = 0; |
| 63 | 64 |
| 65 // Asynchronously changes the state of requests from the store using their | |
| 66 // request id. | |
| 67 virtual void ChangeRequestsState( | |
| 68 const std::vector<int64_t>& request_ids, | |
| 69 const SavePageRequest::RequestState new_state, | |
| 70 const UpdateCallback& callback) = 0; | |
| 71 | |
| 64 // Resets the store. | 72 // Resets the store. |
| 65 virtual void Reset(const ResetCallback& callback) = 0; | 73 virtual void Reset(const ResetCallback& callback) = 0; |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 } // namespace offline_pages | 76 } // namespace offline_pages |
| 69 | 77 |
| 70 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ | 78 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_ |
| OLD | NEW |