Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: content/browser/background_fetch/background_fetch_job_data.h

Issue 2753583002: Add the JobComplete callback and error/interrupt information (Closed)
Patch Set: added argument name Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_
7 7
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "content/browser/background_fetch/background_fetch_request_info.h" 12 #include "content/browser/background_fetch/background_fetch_request_info.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/download_interrupt_reasons.h"
15 #include "content/public/browser/download_item.h"
14 #include "url/origin.h" 16 #include "url/origin.h"
15 17
16 namespace content { 18 namespace content {
17 19
18 // The BackgroundFetchJobData class provides the interface from the 20 // The BackgroundFetchJobData class provides the interface from the
19 // JobController to the data storage in the DataManager. It has a reference 21 // JobController to the data storage in the DataManager. It has a reference
20 // to the DataManager and invokes calls given the stored batch_guid. 22 // to the DataManager and invokes calls given the stored batch_guid.
21 class CONTENT_EXPORT BackgroundFetchJobData { 23 class CONTENT_EXPORT BackgroundFetchJobData {
22 public: 24 public:
23 explicit BackgroundFetchJobData(BackgroundFetchRequestInfos& request_infos); 25 explicit BackgroundFetchJobData(BackgroundFetchRequestInfos& request_infos);
24 ~BackgroundFetchJobData(); 26 ~BackgroundFetchJobData();
25 27
26 // Called by the JobController to inform the JobData that the given fetch 28 // Called by the JobController to inform the JobData that the given fetch
27 // has completed. The JobData returns a boolean indicating whether there 29 // has been updated. The JobData returns a boolean indicating whether there
28 // are more requests to process. 30 // are more requests to process.
29 bool BackgroundFetchRequestInfoComplete(const std::string& fetch_guid); 31 bool UpdateBackgroundFetchRequestState(
32 const std::string& fetch_guid,
33 DownloadItem::DownloadState state,
34 DownloadInterruptReason interrupt_reason);
30 35
31 // Called by the JobController to get a BackgroundFetchRequestInfo to 36 // Called by the JobController to get a BackgroundFetchRequestInfo to
32 // process. 37 // process.
33 const BackgroundFetchRequestInfo& GetNextBackgroundFetchRequestInfo(); 38 const BackgroundFetchRequestInfo& GetNextBackgroundFetchRequestInfo();
34 39
35 // Indicates whether all requests have been handed to the JobController. 40 // Indicates whether all requests have been handed to the JobController.
36 bool HasRequestsRemaining() const; 41 bool HasRequestsRemaining() const;
37 42
38 // Indicates whether all requests have been handed out and completed. 43 // Indicates whether all requests have been handed out and completed.
39 bool IsComplete() const; 44 bool IsComplete() const;
(...skipping 10 matching lines...) Expand all
50 // outstanding requests should be in this map. 55 // outstanding requests should be in this map.
51 std::unordered_map<std::string, int> request_info_index_; 56 std::unordered_map<std::string, int> request_info_index_;
52 size_t next_request_info_ = 0; 57 size_t next_request_info_ = 0;
53 58
54 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobData); 59 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobData);
55 }; 60 };
56 61
57 } // namespace content 62 } // namespace content
58 63
59 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_ 64 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698