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 #include "content/browser/service_worker/service_worker_request_handler.h" | 5 #include "content/browser/service_worker/service_worker_request_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 int kUserDataKey; // Key value is not important. | 27 int kUserDataKey; // Key value is not important. |
28 | 28 |
29 class ServiceWorkerRequestInterceptor | 29 class ServiceWorkerRequestInterceptor |
30 : public net::URLRequestInterceptor { | 30 : public net::URLRequestInterceptor { |
31 public: | 31 public: |
32 explicit ServiceWorkerRequestInterceptor(ResourceContext* resource_context) | 32 explicit ServiceWorkerRequestInterceptor(ResourceContext* resource_context) |
33 : resource_context_(resource_context) {} | 33 : resource_context_(resource_context) {} |
34 ~ServiceWorkerRequestInterceptor() override {} | 34 ~ServiceWorkerRequestInterceptor() override {} |
35 net::URLRequestJob* MaybeInterceptRequest( | 35 net::URLRequestJob* MaybeInterceptRequest( |
36 net::URLRequest* request, | 36 net::URLRequest* request, |
37 net::NetworkDelegate* network_delegate) const override { | 37 net::NetworkDelegate* network_delegate) override { |
38 ServiceWorkerRequestHandler* handler = | 38 ServiceWorkerRequestHandler* handler = |
39 ServiceWorkerRequestHandler::GetHandler(request); | 39 ServiceWorkerRequestHandler::GetHandler(request); |
40 if (!handler) | 40 if (!handler) |
41 return NULL; | 41 return NULL; |
42 return handler->MaybeCreateJob( | 42 return handler->MaybeCreateJob( |
43 request, network_delegate, resource_context_); | 43 request, network_delegate, resource_context_); |
44 } | 44 } |
45 | 45 |
| 46 net::URLRequestJob* MaybeInterceptRedirect( |
| 47 net::URLRequest* request, |
| 48 net::NetworkDelegate* network_delegate, |
| 49 const GURL& location) override { |
| 50 return NULL; |
| 51 } |
| 52 |
| 53 net::URLRequestJob* MaybeInterceptResponse( |
| 54 net::URLRequest* request, |
| 55 net::NetworkDelegate* network_delegate) override { |
| 56 return NULL; |
| 57 } |
| 58 |
46 private: | 59 private: |
47 ResourceContext* resource_context_; | 60 ResourceContext* resource_context_; |
48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestInterceptor); | 61 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestInterceptor); |
49 }; | 62 }; |
50 | 63 |
51 // This is work around to avoid hijacking CORS preflight. | 64 // This is work around to avoid hijacking CORS preflight. |
52 // TODO(horo): Remove this check when we implement "HTTP fetch" correctly. | 65 // TODO(horo): Remove this check when we implement "HTTP fetch" correctly. |
53 // http://fetch.spec.whatwg.org/#concept-http-fetch | 66 // http://fetch.spec.whatwg.org/#concept-http-fetch |
54 bool IsMethodSupportedForServiceWorker(const std::string& method) { | 67 bool IsMethodSupportedForServiceWorker(const std::string& method) { |
55 return method != "OPTIONS"; | 68 return method != "OPTIONS"; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 base::WeakPtr<ServiceWorkerProviderHost> provider_host, | 150 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
138 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 151 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
139 ResourceType resource_type) | 152 ResourceType resource_type) |
140 : context_(context), | 153 : context_(context), |
141 provider_host_(provider_host), | 154 provider_host_(provider_host), |
142 blob_storage_context_(blob_storage_context), | 155 blob_storage_context_(blob_storage_context), |
143 resource_type_(resource_type) { | 156 resource_type_(resource_type) { |
144 } | 157 } |
145 | 158 |
146 } // namespace content | 159 } // namespace content |
OLD | NEW |