Service Worker: in Unregister, wait until after the active worker no longer controls...
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_context_request_handler.h
blob0c749274e80aa47aee72bfdf26ff572b505c8ef8
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_CONTEXT_REQUEST_HANDLER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_REQUEST_HANDLER_H_
8 #include "content/browser/service_worker/service_worker_request_handler.h"
10 namespace content {
12 class ServiceWorkerVersion;
14 // A request handler derivative used to handle requests from
15 // service workers.
16 class CONTENT_EXPORT ServiceWorkerContextRequestHandler
17 : public ServiceWorkerRequestHandler {
18 public:
19 ServiceWorkerContextRequestHandler(
20 base::WeakPtr<ServiceWorkerContextCore> context,
21 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
22 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
23 ResourceType resource_type);
24 virtual ~ServiceWorkerContextRequestHandler();
26 // Called via custom URLRequestJobFactory.
27 virtual net::URLRequestJob* MaybeCreateJob(
28 net::URLRequest* request,
29 net::NetworkDelegate* network_delegate) OVERRIDE;
31 virtual void GetExtraResponseInfo(
32 bool* was_fetched_via_service_worker,
33 GURL* original_url_via_service_worker) const OVERRIDE;
35 private:
36 bool ShouldAddToScriptCache(const GURL& url);
37 bool ShouldReadFromScriptCache(const GURL& url, int64* response_id_out);
39 scoped_refptr<ServiceWorkerVersion> version_;
41 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextRequestHandler);
44 } // namespace content
46 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_REQUEST_HANDLER_H_