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