Index: content/browser/service_worker/service_worker_controllee_request_handler.h |
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.h b/content/browser/service_worker/service_worker_controllee_request_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4a12fd8610626f909b876c8357168642e235b158 |
--- /dev/null |
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.h |
@@ -0,0 +1,56 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_ |
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_ |
+ |
+#include "content/browser/service_worker/service_worker_request_handler.h" |
+ |
+namespace net { |
+class NetworkDelegate; |
+class URLRequest; |
+} |
+ |
+namespace content { |
+ |
+class ServiceWorkerRegistration; |
+class ServiceWorkerURLRequestJob; |
+ |
+// A request handler derivative used to handle requests from |
+// controlled documents. |
+class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler |
+ : public ServiceWorkerRequestHandler { |
+ public: |
+ ServiceWorkerControlleeRequestHandler( |
+ base::WeakPtr<ServiceWorkerContextCore> context, |
+ base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
+ ResourceType::Type resource_type); |
+ virtual ~ServiceWorkerControlleeRequestHandler(); |
+ |
+ // Called via custom URLRequestJobFactory. |
+ virtual net::URLRequestJob* MaybeCreateJob( |
+ net::URLRequest* request, |
+ net::NetworkDelegate* network_delegate) OVERRIDE; |
+ |
+ private: |
+ typedef ServiceWorkerControlleeRequestHandler self; |
+ |
+ // For main resource case. |
+ void PrepareForMainResource(const GURL& url); |
+ void DidLookupRegistrationForMainResource( |
+ ServiceWorkerStatusCode status, |
+ const scoped_refptr<ServiceWorkerRegistration>& registration); |
+ |
+ // For sub resource case. |
+ void PrepareForSubResource(); |
+ |
+ scoped_refptr<ServiceWorkerURLRequestJob> job_; |
+ base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_ |