Chromium Code Reviews| Index: content/browser/service_worker/service_worker_url_request_job.h |
| diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h |
| index 029871bed969260948766f54e73c318123c609b3..c69a9cfe1c4c532d43082b4c6bd975bd01db3187 100644 |
| --- a/content/browser/service_worker/service_worker_url_request_job.h |
| +++ b/content/browser/service_worker/service_worker_url_request_job.h |
| @@ -103,7 +103,13 @@ class CONTENT_EXPORT ServiceWorkerURLRequestJob |
| ~ServiceWorkerURLRequestJob() override; |
| // Sets the response type. |
| + // When an in-flight request possibly need CORS check, use |
| + // FallbackToNetworkOrRenderer. This method will decide whether the request |
| + // can directly go to the network or should fallback to a renderer to send |
| + // CORS preflight. You can use FallbackToNetwork only when it's apparent that |
| + // the request should go to the network directly. |
|
falken
2016/07/05 06:49:28
Reading this makes me feel there should just be on
shimazu
2016/07/06 06:27:35
Replied to the patch set 1
|
| void FallbackToNetwork(); |
| + void FallbackToNetworkOrRenderer(); |
| void ForwardToServiceWorker(); |
| bool ShouldFallbackToNetwork() const { |
| @@ -156,6 +162,7 @@ class CONTENT_EXPORT ServiceWorkerURLRequestJob |
| enum ResponseType { |
| NOT_DETERMINED, |
| FALLBACK_TO_NETWORK, |
| + FALLBACK_TO_RENDERER, // Use this when falling back with CORS check |
| FORWARD_TO_SERVICE_WORKER, |
| }; |
| @@ -199,6 +206,19 @@ class CONTENT_EXPORT ServiceWorkerURLRequestJob |
| // Creates and commits a response header indicating error. |
| void DeliverErrorResponse(); |
| + // Restarts this job to fallback to network. |
| + // This can be called after StartRequest. |
| + void FinalizeFallbackToNetwork(); |
| + |
| + // Sends back a response with fall_back_required set as true to trigger |
| + // subsequent network requests with CORS checking. |
| + // This can be called after StartRequest. |
| + void FinalizeFallbackToRenderer(); |
| + |
| + // True if need to send back a response with fall_back_required set as true to |
| + // trigger subsequent network requests with CORS checking. |
| + bool IsFallbackToRendererNeeded() const; |
| + |
| // For UMA. |
| void SetResponseBodyType(ResponseBodyType type); |
| bool ShouldRecordResult(); |