OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ | |
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <map> | |
11 | |
12 #include "base/macros.h" | |
13 #include "components/offline_pages/background/request_queue_store.h" | |
14 #include "components/offline_pages/background/save_page_request.h" | |
15 | |
16 namespace offline_pages { | |
17 | |
18 // Interface for classes storing save page requests. | |
19 class RequestQueueInMemoryStore : public RequestQueueStore { | |
20 public: | |
21 RequestQueueInMemoryStore(); | |
22 ~RequestQueueInMemoryStore() override; | |
23 | |
24 // RequestQueueStore implementaiton. | |
25 void GetRequests(const GetRequestsCallback& callback) override; | |
26 void GetRequestsByIds(const std::vector<int64_t>& request_ids, | |
27 const UpdateCallback& callback) override; | |
28 void AddRequest(const SavePageRequest& offline_page, | |
29 const AddCallback& callback) override; | |
30 void UpdateRequests(const std::vector<SavePageRequest>& requests, | |
31 const UpdateCallback& callback) override; | |
32 void RemoveRequests(const std::vector<int64_t>& request_ids, | |
33 const UpdateCallback& callback) override; | |
34 | |
35 void Reset(const ResetCallback& callback) override; | |
36 StoreState state() const override; | |
37 | |
38 private: | |
39 typedef std::map<int64_t, SavePageRequest> RequestsMap; | |
40 RequestsMap requests_; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); | |
43 }; | |
44 | |
45 } // namespace offline_pages | |
46 | |
47 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ | |
OLD | NEW |