| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 | 33 |
| 34 class ResourceContext; | 34 class ResourceContext; |
| 35 class ResourceMessageFilter; | 35 class ResourceMessageFilter; |
| 36 class ResourceRequestBody; | 36 class ResourceRequestBody; |
| 37 class ServiceWorkerContextCore; | 37 class ServiceWorkerContextCore; |
| 38 class ServiceWorkerContextWrapper; | 38 class ServiceWorkerContextWrapper; |
| 39 class ServiceWorkerNavigationHandleCore; | 39 class ServiceWorkerNavigationHandleCore; |
| 40 class ServiceWorkerProviderHost; | 40 class ServiceWorkerProviderHost; |
| 41 struct ResourceResponseInfo; | |
| 42 | 41 |
| 43 // Abstract base class for routing network requests to ServiceWorkers. | 42 // Abstract base class for routing network requests to ServiceWorkers. |
| 44 // Created one per URLRequest and attached to each request. | 43 // Created one per URLRequest and attached to each request. |
| 45 class CONTENT_EXPORT ServiceWorkerRequestHandler | 44 class CONTENT_EXPORT ServiceWorkerRequestHandler |
| 46 : public base::SupportsUserData::Data { | 45 : public base::SupportsUserData::Data { |
| 47 public: | 46 public: |
| 48 // PlzNavigate | 47 // PlzNavigate |
| 49 // Attaches a newly created handler if the given |request| needs to be handled | 48 // Attaches a newly created handler if the given |request| needs to be handled |
| 50 // by ServiceWorker. | 49 // by ServiceWorker. |
| 51 static void InitializeForNavigation( | 50 static void InitializeForNavigation( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 static bool IsControlledByServiceWorker(net::URLRequest* request); | 94 static bool IsControlledByServiceWorker(net::URLRequest* request); |
| 96 | 95 |
| 97 ~ServiceWorkerRequestHandler() override; | 96 ~ServiceWorkerRequestHandler() override; |
| 98 | 97 |
| 99 // Called via custom URLRequestJobFactory. | 98 // Called via custom URLRequestJobFactory. |
| 100 virtual net::URLRequestJob* MaybeCreateJob( | 99 virtual net::URLRequestJob* MaybeCreateJob( |
| 101 net::URLRequest* request, | 100 net::URLRequest* request, |
| 102 net::NetworkDelegate* network_delegate, | 101 net::NetworkDelegate* network_delegate, |
| 103 ResourceContext* context) = 0; | 102 ResourceContext* context) = 0; |
| 104 | 103 |
| 105 virtual void GetExtraResponseInfo( | |
| 106 ResourceResponseInfo* response_info) const = 0; | |
| 107 | |
| 108 // Methods to support cross site navigations. | 104 // Methods to support cross site navigations. |
| 109 void PrepareForCrossSiteTransfer(int old_process_id); | 105 void PrepareForCrossSiteTransfer(int old_process_id); |
| 110 void CompleteCrossSiteTransfer(int new_process_id, | 106 void CompleteCrossSiteTransfer(int new_process_id, |
| 111 int new_provider_id); | 107 int new_provider_id); |
| 112 void MaybeCompleteCrossSiteTransferInOldProcess( | 108 void MaybeCompleteCrossSiteTransferInOldProcess( |
| 113 int old_process_id); | 109 int old_process_id); |
| 114 | 110 |
| 115 // Useful for detecting storage partition mismatches in the context of cross | 111 // Useful for detecting storage partition mismatches in the context of cross |
| 116 // site transfer navigations. | 112 // site transfer navigations. |
| 117 bool SanityCheckIsSameContext(ServiceWorkerContextWrapper* wrapper); | 113 bool SanityCheckIsSameContext(ServiceWorkerContextWrapper* wrapper); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 132 std::unique_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; | 128 std::unique_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; |
| 133 int old_process_id_; | 129 int old_process_id_; |
| 134 int old_provider_id_; | 130 int old_provider_id_; |
| 135 | 131 |
| 136 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 132 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
| 137 }; | 133 }; |
| 138 | 134 |
| 139 } // namespace content | 135 } // namespace content |
| 140 | 136 |
| 141 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 137 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
| OLD | NEW |