| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace storage { | 26 namespace storage { |
| 27 class BlobStorageContext; | 27 class BlobStorageContext; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 class ResourceContext; | 32 class ResourceContext; |
| 33 class ResourceRequestBody; | 33 class ResourceRequestBody; |
| 34 class ServiceWorkerContextCore; | 34 class ServiceWorkerContextCore; |
| 35 class ServiceWorkerContextWrapper; | 35 class ServiceWorkerContextWrapper; |
| 36 class ServiceWorkerNavigationHandleCore; |
| 36 class ServiceWorkerProviderHost; | 37 class ServiceWorkerProviderHost; |
| 37 struct ResourceResponseInfo; | 38 struct ResourceResponseInfo; |
| 38 | 39 |
| 39 // Abstract base class for routing network requests to ServiceWorkers. | 40 // Abstract base class for routing network requests to ServiceWorkers. |
| 40 // Created one per URLRequest and attached to each request. | 41 // Created one per URLRequest and attached to each request. |
| 41 class CONTENT_EXPORT ServiceWorkerRequestHandler | 42 class CONTENT_EXPORT ServiceWorkerRequestHandler |
| 42 : public base::SupportsUserData::Data { | 43 : public base::SupportsUserData::Data { |
| 43 public: | 44 public: |
| 45 // PlzNavigate |
| 46 // Attaches a newly created handler if the given |request| needs to be handled |
| 47 // by ServiceWorker. |
| 48 static void InitializeForNavigation( |
| 49 net::URLRequest* request, |
| 50 ServiceWorkerNavigationHandleCore* navigation_handle_core, |
| 51 storage::BlobStorageContext* blob_storage_context, |
| 52 bool skip_service_worker, |
| 53 ResourceType resource_type, |
| 54 RequestContextType request_context_type, |
| 55 RequestContextFrameType frame_type, |
| 56 scoped_refptr<ResourceRequestBody> body); |
| 57 |
| 44 // Attaches a newly created handler if the given |request| needs to | 58 // Attaches a newly created handler if the given |request| needs to |
| 45 // be handled by ServiceWorker. | 59 // be handled by ServiceWorker. |
| 46 // TODO(kinuko): While utilizing UserData to attach data to URLRequest | 60 // TODO(kinuko): While utilizing UserData to attach data to URLRequest |
| 47 // has some precedence, it might be better to attach this handler in a more | 61 // has some precedence, it might be better to attach this handler in a more |
| 48 // explicit way within content layer, e.g. have ResourceRequestInfoImpl | 62 // explicit way within content layer, e.g. have ResourceRequestInfoImpl |
| 49 // own it. | 63 // own it. |
| 50 static void InitializeHandler( | 64 static void InitializeHandler( |
| 51 net::URLRequest* request, | 65 net::URLRequest* request, |
| 52 ServiceWorkerContextWrapper* context_wrapper, | 66 ServiceWorkerContextWrapper* context_wrapper, |
| 53 storage::BlobStorageContext* blob_storage_context, | 67 storage::BlobStorageContext* blob_storage_context, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 scoped_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; | 127 scoped_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; |
| 114 int old_process_id_; | 128 int old_process_id_; |
| 115 int old_provider_id_; | 129 int old_provider_id_; |
| 116 | 130 |
| 117 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 131 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
| 118 }; | 132 }; |
| 119 | 133 |
| 120 } // namespace content | 134 } // namespace content |
| 121 | 135 |
| 122 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 136 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
| OLD | NEW |