Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / browser / service_worker / service_worker_request_handler.h
index 4e03fbc..91afd26 100644 (file)
 #include "base/time/time.h"
 #include "content/common/content_export.h"
 #include "content/common/service_worker/service_worker_status_code.h"
+#include "content/common/service_worker/service_worker_types.h"
+#include "content/public/common/request_context_frame_type.h"
+#include "content/public/common/request_context_type.h"
 #include "content/public/common/resource_type.h"
 #include "net/url_request/url_request_job_factory.h"
+#include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h"
 
 namespace net {
 class NetworkDelegate;
@@ -26,6 +30,7 @@ class BlobStorageContext;
 
 namespace content {
 
+class ResourceContext;
 class ResourceRequestBody;
 class ServiceWorkerContextCore;
 class ServiceWorkerContextWrapper;
@@ -49,7 +54,11 @@ class CONTENT_EXPORT ServiceWorkerRequestHandler
       int process_id,
       int provider_id,
       bool skip_service_worker,
+      FetchRequestMode request_mode,
+      FetchCredentialsMode credentials_mode,
       ResourceType resource_type,
+      RequestContextType request_context_type,
+      RequestContextFrameType frame_type,
       scoped_refptr<ResourceRequestBody> body);
 
   // Returns the handler attached to |request|. This may return NULL
@@ -58,18 +67,28 @@ class CONTENT_EXPORT ServiceWorkerRequestHandler
       net::URLRequest* request);
 
   // Creates a protocol interceptor for ServiceWorker.
-  static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor();
+  static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(
+      ResourceContext* resource_context);
 
-  virtual ~ServiceWorkerRequestHandler();
+  // Returns true if the request falls into the scope of a ServiceWorker.
+  // It's only reliable after the ServiceWorkerRequestHandler MaybeCreateJob
+  // method runs to completion for this request. The AppCache handler uses
+  // this to avoid colliding with ServiceWorkers.
+  static bool IsControlledByServiceWorker(net::URLRequest* request);
+
+  ~ServiceWorkerRequestHandler() override;
 
   // Called via custom URLRequestJobFactory.
   virtual net::URLRequestJob* MaybeCreateJob(
       net::URLRequest* request,
-      net::NetworkDelegate* network_delegate) = 0;
+      net::NetworkDelegate* network_delegate,
+      ResourceContext* context) = 0;
 
   virtual void GetExtraResponseInfo(
       bool* was_fetched_via_service_worker,
+      bool* was_fallback_required_by_service_worker,
       GURL* original_url_via_service_worker,
+      blink::WebServiceWorkerResponseType* response_type_via_service_worker,
       base::TimeTicks* fetch_start_time,
       base::TimeTicks* fetch_ready_time,
       base::TimeTicks* fetch_end_time) const = 0;