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_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/service_worker/service_worker_status_code.h" | 12 #include "content/common/service_worker/service_worker_status_code.h" |
13 #include "net/url_request/url_request_job_factory.h" | 13 #include "net/url_request/url_request_job_factory.h" |
14 #include "webkit/common/resource_type.h" | 14 #include "webkit/common/resource_type.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class NetworkDelegate; | 17 class NetworkDelegate; |
18 class URLRequest; | 18 class URLRequest; |
| 19 class URLRequestInterceptor; |
19 } | 20 } |
20 | 21 |
21 namespace webkit_blob { | 22 namespace webkit_blob { |
22 class BlobStorageContext; | 23 class BlobStorageContext; |
23 } | 24 } |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 class ServiceWorkerContextCore; | 28 class ServiceWorkerContextCore; |
28 class ServiceWorkerContextWrapper; | 29 class ServiceWorkerContextWrapper; |
(...skipping 17 matching lines...) Expand all Loading... |
46 int process_id, | 47 int process_id, |
47 int provider_id, | 48 int provider_id, |
48 ResourceType::Type resource_type); | 49 ResourceType::Type resource_type); |
49 | 50 |
50 // Returns the handler attached to |request|. This may return NULL | 51 // Returns the handler attached to |request|. This may return NULL |
51 // if no handler is attached. | 52 // if no handler is attached. |
52 static ServiceWorkerRequestHandler* GetHandler( | 53 static ServiceWorkerRequestHandler* GetHandler( |
53 net::URLRequest* request); | 54 net::URLRequest* request); |
54 | 55 |
55 // Creates a protocol interceptor for ServiceWorker. | 56 // Creates a protocol interceptor for ServiceWorker. |
56 static scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 57 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); |
57 CreateInterceptor(); | |
58 | 58 |
59 virtual ~ServiceWorkerRequestHandler(); | 59 virtual ~ServiceWorkerRequestHandler(); |
60 | 60 |
61 // Called via custom URLRequestJobFactory. | 61 // Called via custom URLRequestJobFactory. |
62 virtual net::URLRequestJob* MaybeCreateJob( | 62 virtual net::URLRequestJob* MaybeCreateJob( |
63 net::URLRequest* request, | 63 net::URLRequest* request, |
64 net::NetworkDelegate* network_delegate) = 0; | 64 net::NetworkDelegate* network_delegate) = 0; |
65 | 65 |
66 protected: | 66 protected: |
67 ServiceWorkerRequestHandler( | 67 ServiceWorkerRequestHandler( |
68 base::WeakPtr<ServiceWorkerContextCore> context, | 68 base::WeakPtr<ServiceWorkerContextCore> context, |
69 base::WeakPtr<ServiceWorkerProviderHost> provider_host, | 69 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
70 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, | 70 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, |
71 ResourceType::Type resource_type); | 71 ResourceType::Type resource_type); |
72 | 72 |
73 base::WeakPtr<ServiceWorkerContextCore> context_; | 73 base::WeakPtr<ServiceWorkerContextCore> context_; |
74 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; | 74 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
75 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context_; | 75 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context_; |
76 ResourceType::Type resource_type_; | 76 ResourceType::Type resource_type_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 78 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace content | 81 } // namespace content |
82 | 82 |
83 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 83 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
OLD | NEW |