OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/optional.h" |
10 #include "base/supports_user_data.h" | 11 #include "base/supports_user_data.h" |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "content/browser/service_worker/service_worker_url_request_job.h" | 13 #include "content/browser/service_worker/service_worker_url_request_job.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
14 #include "content/common/service_worker/service_worker_status_code.h" | 15 #include "content/common/service_worker/service_worker_status_code.h" |
15 #include "content/common/service_worker/service_worker_types.h" | 16 #include "content/common/service_worker/service_worker_types.h" |
16 #include "content/public/common/request_context_frame_type.h" | 17 #include "content/public/common/request_context_frame_type.h" |
17 #include "content/public/common/request_context_type.h" | 18 #include "content/public/common/request_context_type.h" |
18 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
19 #include "net/url_request/url_request_job_factory.h" | 20 #include "net/url_request/url_request_job_factory.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 88 |
88 ForeignFetchRequestHandler( | 89 ForeignFetchRequestHandler( |
89 ServiceWorkerContextWrapper* context, | 90 ServiceWorkerContextWrapper* context, |
90 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 91 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
91 FetchRequestMode request_mode, | 92 FetchRequestMode request_mode, |
92 FetchCredentialsMode credentials_mode, | 93 FetchCredentialsMode credentials_mode, |
93 FetchRedirectMode redirect_mode, | 94 FetchRedirectMode redirect_mode, |
94 ResourceType resource_type, | 95 ResourceType resource_type, |
95 RequestContextType request_context_type, | 96 RequestContextType request_context_type, |
96 RequestContextFrameType frame_type, | 97 RequestContextFrameType frame_type, |
97 scoped_refptr<ResourceRequestBodyImpl> body); | 98 scoped_refptr<ResourceRequestBodyImpl> body, |
| 99 const base::Optional<base::TimeDelta>& timeout); |
98 | 100 |
99 // Called when a ServiceWorkerRegistration has (or hasn't) been found for the | 101 // Called when a ServiceWorkerRegistration has (or hasn't) been found for the |
100 // request being handled. | 102 // request being handled. |
101 void DidFindRegistration( | 103 void DidFindRegistration( |
102 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, | 104 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, |
103 ServiceWorkerStatusCode status, | 105 ServiceWorkerStatusCode status, |
104 scoped_refptr<ServiceWorkerRegistration> registration); | 106 scoped_refptr<ServiceWorkerRegistration> registration); |
105 | 107 |
106 // ServiceWorkerURLRequestJob::Delegate implementation: | 108 // ServiceWorkerURLRequestJob::Delegate implementation: |
107 void OnPrepareToRestart() override; | 109 void OnPrepareToRestart() override; |
(...skipping 13 matching lines...) Expand all Loading... |
121 scoped_refptr<ServiceWorkerContextWrapper> context_; | 123 scoped_refptr<ServiceWorkerContextWrapper> context_; |
122 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 124 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
123 ResourceType resource_type_; | 125 ResourceType resource_type_; |
124 FetchRequestMode request_mode_; | 126 FetchRequestMode request_mode_; |
125 FetchCredentialsMode credentials_mode_; | 127 FetchCredentialsMode credentials_mode_; |
126 FetchRedirectMode redirect_mode_; | 128 FetchRedirectMode redirect_mode_; |
127 RequestContextType request_context_type_; | 129 RequestContextType request_context_type_; |
128 RequestContextFrameType frame_type_; | 130 RequestContextFrameType frame_type_; |
129 scoped_refptr<ResourceRequestBodyImpl> body_; | 131 scoped_refptr<ResourceRequestBodyImpl> body_; |
130 ResourceContext* resource_context_; | 132 ResourceContext* resource_context_; |
| 133 base::Optional<base::TimeDelta> timeout_; |
131 | 134 |
132 base::WeakPtr<ServiceWorkerURLRequestJob> job_; | 135 base::WeakPtr<ServiceWorkerURLRequestJob> job_; |
133 scoped_refptr<ServiceWorkerVersion> target_worker_; | 136 scoped_refptr<ServiceWorkerVersion> target_worker_; |
134 | 137 |
135 // True if the next time this request is started, the response should be | 138 // True if the next time this request is started, the response should be |
136 // delivered from the network, bypassing the ServiceWorker. | 139 // delivered from the network, bypassing the ServiceWorker. |
137 bool use_network_ = false; | 140 bool use_network_ = false; |
138 | 141 |
139 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; | 142 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; |
140 | 143 |
141 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); | 144 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); |
142 }; | 145 }; |
143 | 146 |
144 } // namespace content | 147 } // namespace content |
145 | 148 |
146 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 149 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
OLD | NEW |