Implement SSLKEYLOGFILE for OpenSSL.
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_controllee_request_handler.h
blob1ec528615eabb75606b01d789fa93eca54406035
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.
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_
8 #include "base/gtest_prod_util.h"
9 #include "content/browser/service_worker/service_worker_request_handler.h"
11 namespace net {
12 class NetworkDelegate;
13 class URLRequest;
16 namespace content {
18 class ResourceRequestBody;
19 class ServiceWorkerRegistration;
20 class ServiceWorkerURLRequestJob;
21 class ServiceWorkerVersion;
23 // A request handler derivative used to handle requests from
24 // controlled documents.
25 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler
26 : public ServiceWorkerRequestHandler {
27 public:
28 ServiceWorkerControlleeRequestHandler(
29 base::WeakPtr<ServiceWorkerContextCore> context,
30 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
31 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
32 ResourceType resource_type,
33 scoped_refptr<ResourceRequestBody> body);
34 virtual ~ServiceWorkerControlleeRequestHandler();
36 // Called via custom URLRequestJobFactory.
37 virtual net::URLRequestJob* MaybeCreateJob(
38 net::URLRequest* request,
39 net::NetworkDelegate* network_delegate) OVERRIDE;
41 virtual void GetExtraResponseInfo(
42 bool* was_fetched_via_service_worker,
43 GURL* original_url_via_service_worker) const OVERRIDE;
45 private:
46 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest,
47 ActivateWaitingVersion);
48 typedef ServiceWorkerControlleeRequestHandler self;
50 // For main resource case.
51 void PrepareForMainResource(const GURL& url);
52 void DidLookupRegistrationForMainResource(
53 ServiceWorkerStatusCode status,
54 const scoped_refptr<ServiceWorkerRegistration>& registration);
55 void OnVersionStatusChanged(
56 ServiceWorkerRegistration* registration,
57 ServiceWorkerVersion* version);
59 // For sub resource case.
60 void PrepareForSubResource();
62 bool is_main_resource_load_;
63 scoped_refptr<ServiceWorkerURLRequestJob> job_;
64 scoped_refptr<ResourceRequestBody> body_;
65 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_;
67 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler);
70 } // namespace content
72 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_