OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ | |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/callback.h" | |
13 #include "base/callback_forward.h" | |
14 #include "content/public/browser/blob_handle.h" | |
15 | |
16 namespace content { | |
17 | |
18 using BackgroundFetchResponseCompleteCallback = | |
19 base::Callback<void(std::vector<std::unique_ptr<BlobHandle>>)>; | |
20 | |
21 // Temporary holding class to aggregate the response data for requests | |
22 // associated with a given BackgroundFetch job. | |
23 class BackgroundFetchJobResponseData { | |
24 public: | |
25 BackgroundFetchJobResponseData( | |
26 size_t num_requests, | |
27 const BackgroundFetchResponseCompleteCallback& completion_callback); | |
28 ~BackgroundFetchJobResponseData(); | |
29 | |
30 void AddResponse(int request_num, std::unique_ptr<BlobHandle> response); | |
31 bool IsComplete(); | |
32 | |
33 private: | |
34 std::vector<std::unique_ptr<BlobHandle>> blobs_; | |
35 size_t num_requests_ = 0; | |
36 size_t completed_requests_ = 0; | |
37 const std::string job_guid_; | |
38 BackgroundFetchResponseCompleteCallback completion_callback_; | |
39 }; | |
Peter Beverloo
2017/03/27 10:01:14
DISALLOW_COPY_AND_ASSIGN
harkness
2017/03/27 11:47:49
Done.
| |
40 | |
41 } // namespace content | |
42 | |
43 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H _ | |
OLD | NEW |