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_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 | 15 |
| 16 namespace offline_pages { | 16 namespace offline_pages { |
| 17 | 17 |
| 18 class RequestQueueStore; | 18 class RequestQueueStore; |
| 19 class SavePageRequest; | 19 class SavePageRequest; |
| 20 | 20 |
| 21 // Class responsible for managing save page requests. | 21 // Class responsible for managing save page requests. |
| 22 class RequestQueue { | 22 class RequestQueue { |
| 23 public: | 23 public: |
| 24 enum class GetRequestsResult { | 24 enum class GetRequestsResult { |
| 25 kSuccess, | 25 SUCCESS, |
| 26 kStoreFailure, | 26 STORE_FAILURE, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 enum class AddRequestResult { | 29 enum class AddRequestResult { |
| 30 kSuccess, | 30 SUCCESS, |
| 31 kStoreFailure, | 31 STORE_FAILURE, |
| 32 kRequestQuotaHit, // Cannot add a request with this namespace, as it has | 32 REQUEST_QUOTA_HIT, // Cannot add a request with this namespace, as it has |
| 33 // reached a quota of active requests. | 33 // reached a quota of active requests. |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 enum class UpdateRequestResult { | 36 enum class UpdateRequestResult { |
| 37 kSuccess, | 37 SUCCESS, |
| 38 kStoreFailure, | 38 STORE_FAILURE, |
| 39 kRequestDoesNotExist, // Failed to delete the request because it does not | 39 REQUEST_DOES_NOT_EXIST, // Failed to delete the request because it does not |
| 40 // exist. | 40 // exist. |
|
fgorski
2016/06/11 16:25:06
nit: align the line to the comment above.
Vivian
2016/06/13 17:07:04
Done.
| |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Callback used for |GetRequests|. | 43 // Callback used for |GetRequests|. |
| 44 typedef base::Callback<void(GetRequestsResult, | 44 typedef base::Callback<void(GetRequestsResult, |
| 45 const std::vector<SavePageRequest>&)> | 45 const std::vector<SavePageRequest>&)> |
| 46 GetRequestsCallback; | 46 GetRequestsCallback; |
| 47 | 47 |
| 48 // Callback used for |AddRequest|. | 48 // Callback used for |AddRequest|. |
| 49 typedef base::Callback<void(AddRequestResult, const SavePageRequest& request)> | 49 typedef base::Callback<void(AddRequestResult, const SavePageRequest& request)> |
| 50 AddRequestCallback; | 50 AddRequestCallback; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 void PurgeRequests(const PurgeRequestsCallback& callback); | 87 void PurgeRequests(const PurgeRequestsCallback& callback); |
| 88 | 88 |
| 89 std::unique_ptr<RequestQueueStore> store_; | 89 std::unique_ptr<RequestQueueStore> store_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(RequestQueue); | 91 DISALLOW_COPY_AND_ASSIGN(RequestQueue); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace offline_pages | 94 } // namespace offline_pages |
| 95 | 95 |
| 96 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_H_ | 96 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_H_ |
| OLD | NEW |