| 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_CONTROLLEE_REQUEST_HANDLER
_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER
_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER
_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER
_H_ |
| 7 | 7 |
| 8 #include "content/browser/service_worker/service_worker_request_handler.h" | 8 #include "content/browser/service_worker/service_worker_request_handler.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 class NetworkDelegate; | 11 class NetworkDelegate; |
| 12 class URLRequest; | 12 class URLRequest; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class ServiceWorkerRegistration; | 17 class ServiceWorkerRegistration; |
| 18 class ServiceWorkerURLRequestJob; | 18 class ServiceWorkerURLRequestJob; |
| 19 | 19 |
| 20 // A request handler derivative used to handle requests from | 20 // A request handler derivative used to handle requests from |
| 21 // controlled documents. | 21 // controlled documents. |
| 22 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler | 22 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler |
| 23 : public ServiceWorkerRequestHandler { | 23 : public ServiceWorkerRequestHandler { |
| 24 public: | 24 public: |
| 25 ServiceWorkerControlleeRequestHandler( | 25 ServiceWorkerControlleeRequestHandler( |
| 26 base::WeakPtr<ServiceWorkerContextCore> context, | 26 base::WeakPtr<ServiceWorkerContextCore> context, |
| 27 base::WeakPtr<ServiceWorkerProviderHost> provider_host, | 27 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
| 28 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, |
| 28 ResourceType::Type resource_type); | 29 ResourceType::Type resource_type); |
| 29 virtual ~ServiceWorkerControlleeRequestHandler(); | 30 virtual ~ServiceWorkerControlleeRequestHandler(); |
| 30 | 31 |
| 31 // Called via custom URLRequestJobFactory. | 32 // Called via custom URLRequestJobFactory. |
| 32 virtual net::URLRequestJob* MaybeCreateJob( | 33 virtual net::URLRequestJob* MaybeCreateJob( |
| 33 net::URLRequest* request, | 34 net::URLRequest* request, |
| 34 net::NetworkDelegate* network_delegate) OVERRIDE; | 35 net::NetworkDelegate* network_delegate) OVERRIDE; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 typedef ServiceWorkerControlleeRequestHandler self; | 38 typedef ServiceWorkerControlleeRequestHandler self; |
| 38 | 39 |
| 39 // For main resource case. | 40 // For main resource case. |
| 40 void PrepareForMainResource(const GURL& url); | 41 void PrepareForMainResource(const GURL& url); |
| 41 void DidLookupRegistrationForMainResource( | 42 void DidLookupRegistrationForMainResource( |
| 42 ServiceWorkerStatusCode status, | 43 ServiceWorkerStatusCode status, |
| 43 const scoped_refptr<ServiceWorkerRegistration>& registration); | 44 const scoped_refptr<ServiceWorkerRegistration>& registration); |
| 44 | 45 |
| 45 // For sub resource case. | 46 // For sub resource case. |
| 46 void PrepareForSubResource(); | 47 void PrepareForSubResource(); |
| 47 | 48 |
| 48 scoped_refptr<ServiceWorkerURLRequestJob> job_; | 49 scoped_refptr<ServiceWorkerURLRequestJob> job_; |
| 49 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_; | 50 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler); | 52 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace content | 55 } // namespace content |
| 55 | 56 |
| 56 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND
LER_H_ | 57 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND
LER_H_ |
| OLD | NEW |