Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 } | 24 } |
| 25 | 25 |
| 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 NavigationURLLoaderImplCore; | |
| 34 class ServiceWorkerContextCore; | 35 class ServiceWorkerContextCore; |
| 35 class ServiceWorkerContextWrapper; | 36 class ServiceWorkerContextWrapper; |
| 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: |
| 44 // Attaches a newly created handler if the given |request| needs to | 45 // Attaches a newly created handler if the given |request| needs to |
| 45 // be handled by ServiceWorker. | 46 // be handled by ServiceWorker. |
| 46 // TODO(kinuko): While utilizing UserData to attach data to URLRequest | 47 // 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 | 48 // has some precedence, it might be better to attach this handler in a more |
| 48 // explicit way within content layer, e.g. have ResourceRequestInfoImpl | 49 // explicit way within content layer, e.g. have ResourceRequestInfoImpl |
| 49 // own it. | 50 // own it. |
| 50 static void InitializeHandler( | 51 static void InitializeHandler( |
| 51 net::URLRequest* request, | 52 net::URLRequest* request, |
| 52 ServiceWorkerContextWrapper* context_wrapper, | 53 ServiceWorkerContextWrapper* context_wrapper, |
| 53 storage::BlobStorageContext* blob_storage_context, | 54 storage::BlobStorageContext* blob_storage_context, |
| 54 int process_id, | 55 int process_id, |
| 55 int provider_id, | 56 int provider_id, |
| 56 bool skip_service_worker, | 57 bool skip_service_worker, |
| 57 FetchRequestMode request_mode, | 58 FetchRequestMode request_mode, |
| 58 FetchCredentialsMode credentials_mode, | 59 FetchCredentialsMode credentials_mode, |
| 59 FetchRedirectMode redirect_mode, | 60 FetchRedirectMode redirect_mode, |
| 60 ResourceType resource_type, | 61 ResourceType resource_type, |
| 61 RequestContextType request_context_type, | 62 RequestContextType request_context_type, |
| 62 RequestContextFrameType frame_type, | 63 RequestContextFrameType frame_type, |
| 63 scoped_refptr<ResourceRequestBody> body); | 64 scoped_refptr<ResourceRequestBody> body, |
| 65 NavigationURLLoaderImplCore* loader); | |
|
clamy
2015/08/27 11:53:45
I'm a bit concerned about providing a raw pointer
Fabrice (no longer in Chrome)
2015/08/28 15:40:16
The loader is only used in this fashion in this me
| |
| 64 | 66 |
| 65 // Returns the handler attached to |request|. This may return NULL | 67 // Returns the handler attached to |request|. This may return NULL |
| 66 // if no handler is attached. | 68 // if no handler is attached. |
| 67 static ServiceWorkerRequestHandler* GetHandler( | 69 static ServiceWorkerRequestHandler* GetHandler( |
| 68 net::URLRequest* request); | 70 net::URLRequest* request); |
| 69 | 71 |
| 70 // Creates a protocol interceptor for ServiceWorker. | 72 // Creates a protocol interceptor for ServiceWorker. |
| 71 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor( | 73 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor( |
| 72 ResourceContext* resource_context); | 74 ResourceContext* resource_context); |
| 73 | 75 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 scoped_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; | 115 scoped_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; |
| 114 int old_process_id_; | 116 int old_process_id_; |
| 115 int old_provider_id_; | 117 int old_provider_id_; |
| 116 | 118 |
| 117 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 119 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
| 118 }; | 120 }; |
| 119 | 121 |
| 120 } // namespace content | 122 } // namespace content |
| 121 | 123 |
| 122 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 124 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
| OLD | NEW |