| 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_CONTROLLEE_REQUEST_HANDLER
_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER
_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER
_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER
_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseType.h" | 23 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseType.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 class NetworkDelegate; | 27 class NetworkDelegate; |
| 28 class URLRequest; | 28 class URLRequest; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 | 32 |
| 33 class ResourceRequestBodyImpl; | 33 class ResourceRequestBody; |
| 34 class ServiceWorkerRegistration; | 34 class ServiceWorkerRegistration; |
| 35 class ServiceWorkerVersion; | 35 class ServiceWorkerVersion; |
| 36 | 36 |
| 37 // A request handler derivative used to handle requests from | 37 // A request handler derivative used to handle requests from |
| 38 // controlled documents. | 38 // controlled documents. |
| 39 // Note that in IsServicificationEnabled cases this is used only for | 39 // Note that in IsServicificationEnabled cases this is used only for |
| 40 // main resource fetch during navigation. | 40 // main resource fetch during navigation. |
| 41 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler | 41 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler |
| 42 : public ServiceWorkerRequestHandler, | 42 : public ServiceWorkerRequestHandler, |
| 43 public ServiceWorkerURLJobWrapper::Delegate { | 43 public ServiceWorkerURLJobWrapper::Delegate { |
| 44 public: | 44 public: |
| 45 ServiceWorkerControlleeRequestHandler( | 45 ServiceWorkerControlleeRequestHandler( |
| 46 base::WeakPtr<ServiceWorkerContextCore> context, | 46 base::WeakPtr<ServiceWorkerContextCore> context, |
| 47 base::WeakPtr<ServiceWorkerProviderHost> provider_host, | 47 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
| 48 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 48 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 49 FetchRequestMode request_mode, | 49 FetchRequestMode request_mode, |
| 50 FetchCredentialsMode credentials_mode, | 50 FetchCredentialsMode credentials_mode, |
| 51 FetchRedirectMode redirect_mode, | 51 FetchRedirectMode redirect_mode, |
| 52 ResourceType resource_type, | 52 ResourceType resource_type, |
| 53 RequestContextType request_context_type, | 53 RequestContextType request_context_type, |
| 54 RequestContextFrameType frame_type, | 54 RequestContextFrameType frame_type, |
| 55 scoped_refptr<ResourceRequestBodyImpl> body); | 55 scoped_refptr<ResourceRequestBody> body); |
| 56 ~ServiceWorkerControlleeRequestHandler() override; | 56 ~ServiceWorkerControlleeRequestHandler() override; |
| 57 | 57 |
| 58 // Called via custom URLRequestJobFactory. | 58 // Called via custom URLRequestJobFactory. |
| 59 // Returning a nullptr indicates that the request is not handled by | 59 // Returning a nullptr indicates that the request is not handled by |
| 60 // this handler. | 60 // this handler. |
| 61 // This could get called multiple times during the lifetime. | 61 // This could get called multiple times during the lifetime. |
| 62 net::URLRequestJob* MaybeCreateJob( | 62 net::URLRequestJob* MaybeCreateJob( |
| 63 net::URLRequest* request, | 63 net::URLRequest* request, |
| 64 net::NetworkDelegate* network_delegate, | 64 net::NetworkDelegate* network_delegate, |
| 65 ResourceContext* resource_context) override; | 65 ResourceContext* resource_context) override; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 bool JobWasCanceled() const; | 121 bool JobWasCanceled() const; |
| 122 | 122 |
| 123 const bool is_main_resource_load_; | 123 const bool is_main_resource_load_; |
| 124 const bool is_main_frame_load_; | 124 const bool is_main_frame_load_; |
| 125 std::unique_ptr<ServiceWorkerURLJobWrapper> url_job_; | 125 std::unique_ptr<ServiceWorkerURLJobWrapper> url_job_; |
| 126 FetchRequestMode request_mode_; | 126 FetchRequestMode request_mode_; |
| 127 FetchCredentialsMode credentials_mode_; | 127 FetchCredentialsMode credentials_mode_; |
| 128 FetchRedirectMode redirect_mode_; | 128 FetchRedirectMode redirect_mode_; |
| 129 RequestContextType request_context_type_; | 129 RequestContextType request_context_type_; |
| 130 RequestContextFrameType frame_type_; | 130 RequestContextFrameType frame_type_; |
| 131 scoped_refptr<ResourceRequestBodyImpl> body_; | 131 scoped_refptr<ResourceRequestBody> body_; |
| 132 ResourceContext* resource_context_; | 132 ResourceContext* resource_context_; |
| 133 GURL stripped_url_; | 133 GURL stripped_url_; |
| 134 bool force_update_started_; | 134 bool force_update_started_; |
| 135 | 135 |
| 136 // True if the next time this request is started, the response should be | 136 // True if the next time this request is started, the response should be |
| 137 // delivered from the network, bypassing the ServiceWorker. Cleared after the | 137 // delivered from the network, bypassing the ServiceWorker. Cleared after the |
| 138 // next intercept opportunity, for main frame requests. | 138 // next intercept opportunity, for main frame requests. |
| 139 bool use_network_; | 139 bool use_network_; |
| 140 | 140 |
| 141 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_; | 141 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_; |
| 142 | 142 |
| 143 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler); | 143 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace content | 146 } // namespace content |
| 147 | 147 |
| 148 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND
LER_H_ | 148 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND
LER_H_ |
| OLD | NEW |