OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/common/service_worker/service_worker_status_code.h" | 10 #include "content/common/service_worker/service_worker_status_code.h" |
11 #include "content/common/service_worker/service_worker_types.h" | 11 #include "content/common/service_worker/service_worker_types.h" |
12 #include "net/http/http_byte_range.h" | 12 #include "net/http/http_byte_range.h" |
13 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
14 #include "net/url_request/url_request_job.h" | 14 #include "net/url_request/url_request_job.h" |
15 | 15 |
16 namespace webkit_blob { | 16 namespace webkit_blob { |
| 17 class BlobDataHandle; |
17 class BlobStorageContext; | 18 class BlobStorageContext; |
18 } | 19 } |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 class ServiceWorkerContextCore; | 23 class ServiceWorkerContextCore; |
23 class ServiceWorkerFetchDispatcher; | 24 class ServiceWorkerFetchDispatcher; |
24 class ServiceWorkerProviderHost; | 25 class ServiceWorkerProviderHost; |
25 | 26 |
26 class CONTENT_EXPORT ServiceWorkerURLRequestJob | 27 class CONTENT_EXPORT ServiceWorkerURLRequestJob |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 FALLBACK_TO_NETWORK, | 89 FALLBACK_TO_NETWORK, |
89 FORWARD_TO_SERVICE_WORKER, | 90 FORWARD_TO_SERVICE_WORKER, |
90 }; | 91 }; |
91 | 92 |
92 // We start processing the request if Start() is called AND response_type_ | 93 // We start processing the request if Start() is called AND response_type_ |
93 // is determined. | 94 // is determined. |
94 void MaybeStartRequest(); | 95 void MaybeStartRequest(); |
95 void StartRequest(); | 96 void StartRequest(); |
96 | 97 |
97 // For FORWARD_TO_SERVICE_WORKER case. | 98 // For FORWARD_TO_SERVICE_WORKER case. |
98 void DidDispatchFetchEvent(ServiceWorkerStatusCode status, | 99 void DidDispatchFetchEvent( |
99 ServiceWorkerFetchEventResult fetch_result, | 100 ServiceWorkerStatusCode status, |
100 const ServiceWorkerResponse& response); | 101 ServiceWorkerFetchEventResult fetch_result, |
| 102 const ServiceWorkerResponse& response, |
| 103 scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle); |
101 | 104 |
102 // Populates |http_response_headers_|. | 105 // Populates |http_response_headers_|. |
103 void CreateResponseHeader(int status_code, | 106 void CreateResponseHeader(int status_code, |
104 const std::string& status_text, | 107 const std::string& status_text, |
105 const std::map<std::string, std::string>& headers); | 108 const std::map<std::string, std::string>& headers); |
106 | 109 |
107 // Creates |http_response_info_| using |http_response_headers_| and calls | 110 // Creates |http_response_info_| using |http_response_headers_| and calls |
108 // NotifyHeadersComplete. | 111 // NotifyHeadersComplete. |
109 void CommitResponseHeader(); | 112 void CommitResponseHeader(); |
110 | 113 |
(...skipping 17 matching lines...) Expand all Loading... |
128 scoped_ptr<net::URLRequest> blob_request_; | 131 scoped_ptr<net::URLRequest> blob_request_; |
129 | 132 |
130 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 133 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
131 | 134 |
132 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 135 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
133 }; | 136 }; |
134 | 137 |
135 } // namespace content | 138 } // namespace content |
136 | 139 |
137 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 140 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
OLD | NEW |