OLD | NEW |
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_FETCH_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_FETCH_REQUEST_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_FETCH_REQUEST_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_FETCH_REQUEST_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "content/common/service_worker/service_worker_types.h" | |
10 #include "url/gurl.h" | 9 #include "url/gurl.h" |
11 #include "url/origin.h" | |
12 | 10 |
13 namespace content { | 11 namespace content { |
14 | 12 |
15 // Simple class to encapsulate the components of a fetch request. | 13 // Simple class to encapsulate the components of a fetch request. |
16 class CONTENT_EXPORT FetchRequest { | 14 class CONTENT_EXPORT FetchRequest { |
17 public: | 15 public: |
18 FetchRequest(); | 16 FetchRequest(); |
19 FetchRequest(const url::Origin& origin, | 17 FetchRequest(const GURL& url, const std::string& tag); |
20 const GURL& url, | |
21 int64_t sw_registration_id, | |
22 const std::string& tag); | |
23 // TODO(harkness): Remove copy constructor once the final (non-map-based) | 18 // TODO(harkness): Remove copy constructor once the final (non-map-based) |
24 // state management is in place. | 19 // state management is in place. |
25 FetchRequest(const FetchRequest& request); | 20 FetchRequest(const FetchRequest& request); |
26 ~FetchRequest(); | 21 ~FetchRequest(); |
27 | 22 |
28 const std::string& guid() const { return guid_; } | 23 const std::string& guid() const { return guid_; } |
29 const url::Origin& origin() const { return origin_; } | |
30 const GURL& url() const { return url_; } | 24 const GURL& url() const { return url_; } |
31 int64_t service_worker_registration_id() const { | |
32 return service_worker_registration_id_; | |
33 } | |
34 const std::string& tag() const { return tag_; } | 25 const std::string& tag() const { return tag_; } |
35 | 26 |
| 27 bool complete() const { return complete_; } |
| 28 void set_complete(bool complete) { complete_ = complete; } |
| 29 |
36 private: | 30 private: |
37 std::string guid_; | 31 std::string guid_; |
38 url::Origin origin_; | |
39 GURL url_; | 32 GURL url_; |
40 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId; | |
41 std::string tag_; | 33 std::string tag_; |
| 34 bool complete_ = false; |
42 }; | 35 }; |
43 | 36 |
44 } // namespace content | 37 } // namespace content |
45 | 38 |
46 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_FETCH_REQUEST_H_ | 39 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_FETCH_REQUEST_H_ |
OLD | NEW |