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_IN_MEMORY_STORE_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/offline_pages/background/request_queue_store.h" | 13 #include "components/offline_pages/background/request_queue_store.h" |
14 #include "components/offline_pages/background/save_page_request.h" | 14 #include "components/offline_pages/background/save_page_request.h" |
15 | 15 |
16 namespace offline_pages { | 16 namespace offline_pages { |
17 | 17 |
18 // Interface for classes storing save page requests. | 18 // Interface for classes storing save page requests. |
19 class RequestQueueInMemoryStore : public RequestQueueStore { | 19 class RequestQueueInMemoryStore : public RequestQueueStore { |
20 public: | 20 public: |
21 RequestQueueInMemoryStore(); | 21 RequestQueueInMemoryStore(); |
22 ~RequestQueueInMemoryStore() override; | 22 ~RequestQueueInMemoryStore() override; |
23 | 23 |
24 // RequestQueueStore implementaiton. | 24 // RequestQueueStore implementaiton. |
25 void GetRequests(const GetRequestsCallback& callback) override; | 25 void GetRequests(const GetRequestsCallback& callback) override; |
26 void AddRequest(const SavePageRequest& offline_page, | |
Pete Williamson
2016/09/21 00:00:07
So are you renaming AddOrUpdateRequest to UpdateRe
fgorski
2016/09/21 05:07:50
Correct.
| |
27 const AddCallback& callback) override; | |
26 void AddOrUpdateRequest(const SavePageRequest& request, | 28 void AddOrUpdateRequest(const SavePageRequest& request, |
27 const UpdateCallback& callback) override; | 29 const UpdateCallback& callback) override; |
28 | 30 |
29 // Remove requests by request ID. The callback will get a list of | 31 // Remove requests by request ID. The callback will get a list of |
30 // UpdateMultipleRequestResults and a list of the removed requests (for use by | 32 // UpdateMultipleRequestResults and a list of the removed requests (for use by |
31 // notifications). | 33 // notifications). |
32 void RemoveRequests(const std::vector<int64_t>& request_ids, | 34 void RemoveRequests(const std::vector<int64_t>& request_ids, |
33 const RemoveCallback& callback) override; | 35 const RemoveCallback& callback) override; |
34 | 36 |
35 // Set the state of associated requests to |new_state|. The callback will get | 37 // Set the state of associated requests to |new_state|. The callback will get |
36 // a list of UpdateMultipleRequestResults, and a list of the updated requests. | 38 // a list of UpdateMultipleRequestResults, and a list of the updated requests. |
37 void ChangeRequestsState( | 39 void ChangeRequestsState( |
38 const std::vector<int64_t>& request_ids, | 40 const std::vector<int64_t>& request_ids, |
39 const SavePageRequest::RequestState new_state, | 41 const SavePageRequest::RequestState new_state, |
40 const UpdateMultipleRequestsCallback& callback) override; | 42 const UpdateMultipleRequestsCallback& callback) override; |
41 | 43 |
42 void Reset(const ResetCallback& callback) override; | 44 void Reset(const ResetCallback& callback) override; |
43 | 45 |
44 private: | 46 private: |
45 typedef std::map<int64_t, SavePageRequest> RequestsMap; | 47 typedef std::map<int64_t, SavePageRequest> RequestsMap; |
46 RequestsMap requests_; | 48 RequestsMap requests_; |
47 | 49 |
48 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); | 50 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); |
49 }; | 51 }; |
50 | 52 |
51 } // namespace offline_pages | 53 } // namespace offline_pages |
52 | 54 |
53 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ | 55 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ |
OLD | NEW |