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

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

Issue 2786783002: Dispatch a bare Service Worker event for a finished Background Fetch (Closed)
Patch Set: Dispatch a bare Service Worker event for a finished Background Fetch Created 3 years, 8 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_REQUEST_INFO_H_ 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 const ServiceWorkerFetchRequest& fetch_request); 26 const ServiceWorkerFetchRequest& fetch_request);
27 // TODO(harkness): Remove copy constructor once the final (non-map-based) 27 // TODO(harkness): Remove copy constructor once the final (non-map-based)
28 // state management is in place. 28 // state management is in place.
29 BackgroundFetchRequestInfo(const BackgroundFetchRequestInfo& request); 29 BackgroundFetchRequestInfo(const BackgroundFetchRequestInfo& request);
30 ~BackgroundFetchRequestInfo(); 30 ~BackgroundFetchRequestInfo();
31 31
32 // Returns the index of this request in the larger Background Fetch fetch. 32 // Returns the index of this request in the larger Background Fetch fetch.
33 // Should only be consumed by the BackgroundFetchDataManager. 33 // Should only be consumed by the BackgroundFetchDataManager.
34 int request_index() const { return request_index_; } 34 int request_index() const { return request_index_; }
35 35
36 const std::string& guid() const { return guid_; } 36 // Returns the Fetch API request object this object encapsulates.
37 const ServiceWorkerFetchRequest& fetch_request() const {
38 return fetch_request_;
39 }
37 40
38 const GURL& GetURL() const; 41 const GURL& GetURL() const;
39 42
40 DownloadItem::DownloadState state() const { return state_; } 43 DownloadItem::DownloadState state() const { return state_; }
41 void set_state(DownloadItem::DownloadState state) { state_ = state; } 44 void set_state(DownloadItem::DownloadState state) { state_ = state; }
42 45
43 const std::string& download_guid() const { return download_guid_; } 46 const std::string& download_guid() const { return download_guid_; }
44 void set_download_guid(const std::string& download_guid) { 47 void set_download_guid(const std::string& download_guid) {
45 download_guid_ = download_guid; 48 download_guid_ = download_guid;
46 } 49 }
(...skipping 15 matching lines...) Expand all
62 65
63 bool IsComplete() const; 66 bool IsComplete() const;
64 67
65 private: 68 private:
66 // Index of this request within a Background Fetch registration. 69 // Index of this request within a Background Fetch registration.
67 int request_index_ = kInvalidBackgroundFetchRequestIndex; 70 int request_index_ = kInvalidBackgroundFetchRequestIndex;
68 71
69 // The request information provided by the developer. 72 // The request information provided by the developer.
70 ServiceWorkerFetchRequest fetch_request_; 73 ServiceWorkerFetchRequest fetch_request_;
71 74
72 std::string guid_;
73 std::string download_guid_; 75 std::string download_guid_;
74 76
75 // The following members do not need to be persisted, they can be reset after 77 // The following members do not need to be persisted, they can be reset after
76 // a chrome restart. 78 // a chrome restart.
77 DownloadItem::DownloadState state_ = 79 DownloadItem::DownloadState state_ =
78 DownloadItem::DownloadState::MAX_DOWNLOAD_STATE; 80 DownloadItem::DownloadState::MAX_DOWNLOAD_STATE;
79 DownloadInterruptReason interrupt_reason_ = 81 DownloadInterruptReason interrupt_reason_ =
80 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE; 82 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE;
81 base::FilePath file_path_; 83 base::FilePath file_path_;
82 int64_t received_bytes_ = 0; 84 int64_t received_bytes_ = 0;
83 }; 85 };
84 86
85 } // namespace content 87 } // namespace content
86 88
87 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ 89 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698