| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 static void InitializeHandler( | 55 static void InitializeHandler( |
| 56 net::URLRequest* request, | 56 net::URLRequest* request, |
| 57 ServiceWorkerContextWrapper* context_wrapper, | 57 ServiceWorkerContextWrapper* context_wrapper, |
| 58 storage::BlobStorageContext* blob_storage_context, | 58 storage::BlobStorageContext* blob_storage_context, |
| 59 int process_id, | 59 int process_id, |
| 60 int provider_id, | 60 int provider_id, |
| 61 ServiceWorkerMode service_worker_mode, | 61 ServiceWorkerMode service_worker_mode, |
| 62 FetchRequestMode request_mode, | 62 FetchRequestMode request_mode, |
| 63 FetchCredentialsMode credentials_mode, | 63 FetchCredentialsMode credentials_mode, |
| 64 FetchRedirectMode redirect_mode, | 64 FetchRedirectMode redirect_mode, |
| 65 const std::string& integrity, |
| 65 ResourceType resource_type, | 66 ResourceType resource_type, |
| 66 RequestContextType request_context_type, | 67 RequestContextType request_context_type, |
| 67 RequestContextFrameType frame_type, | 68 RequestContextFrameType frame_type, |
| 68 scoped_refptr<ResourceRequestBody> body, | 69 scoped_refptr<ResourceRequestBody> body, |
| 69 bool initiated_in_secure_context); | 70 bool initiated_in_secure_context); |
| 70 | 71 |
| 71 // Returns the handler attached to |request|. This may return null | 72 // Returns the handler attached to |request|. This may return null |
| 72 // if no handler is attached. | 73 // if no handler is attached. |
| 73 static ForeignFetchRequestHandler* GetHandler(net::URLRequest* request); | 74 static ForeignFetchRequestHandler* GetHandler(net::URLRequest* request); |
| 74 | 75 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 | 86 |
| 86 private: | 87 private: |
| 87 friend class ForeignFetchRequestHandlerTest; | 88 friend class ForeignFetchRequestHandlerTest; |
| 88 | 89 |
| 89 ForeignFetchRequestHandler( | 90 ForeignFetchRequestHandler( |
| 90 ServiceWorkerContextWrapper* context, | 91 ServiceWorkerContextWrapper* context, |
| 91 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 92 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 92 FetchRequestMode request_mode, | 93 FetchRequestMode request_mode, |
| 93 FetchCredentialsMode credentials_mode, | 94 FetchCredentialsMode credentials_mode, |
| 94 FetchRedirectMode redirect_mode, | 95 FetchRedirectMode redirect_mode, |
| 96 const std::string& integrity, |
| 95 ResourceType resource_type, | 97 ResourceType resource_type, |
| 96 RequestContextType request_context_type, | 98 RequestContextType request_context_type, |
| 97 RequestContextFrameType frame_type, | 99 RequestContextFrameType frame_type, |
| 98 scoped_refptr<ResourceRequestBody> body, | 100 scoped_refptr<ResourceRequestBody> body, |
| 99 const base::Optional<base::TimeDelta>& timeout); | 101 const base::Optional<base::TimeDelta>& timeout); |
| 100 | 102 |
| 101 // Called when a ServiceWorkerRegistration has (or hasn't) been found for the | 103 // Called when a ServiceWorkerRegistration has (or hasn't) been found for the |
| 102 // request being handled. | 104 // request being handled. |
| 103 void DidFindRegistration( | 105 void DidFindRegistration( |
| 104 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, | 106 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 119 // version (< M56) Chrome), or the version has valid Origin Trial token. | 121 // version (< M56) Chrome), or the version has valid Origin Trial token. |
| 120 static bool CheckOriginTrialToken( | 122 static bool CheckOriginTrialToken( |
| 121 const ServiceWorkerVersion* const active_version); | 123 const ServiceWorkerVersion* const active_version); |
| 122 | 124 |
| 123 scoped_refptr<ServiceWorkerContextWrapper> context_; | 125 scoped_refptr<ServiceWorkerContextWrapper> context_; |
| 124 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 126 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
| 125 ResourceType resource_type_; | 127 ResourceType resource_type_; |
| 126 FetchRequestMode request_mode_; | 128 FetchRequestMode request_mode_; |
| 127 FetchCredentialsMode credentials_mode_; | 129 FetchCredentialsMode credentials_mode_; |
| 128 FetchRedirectMode redirect_mode_; | 130 FetchRedirectMode redirect_mode_; |
| 131 std::string integrity_; |
| 129 RequestContextType request_context_type_; | 132 RequestContextType request_context_type_; |
| 130 RequestContextFrameType frame_type_; | 133 RequestContextFrameType frame_type_; |
| 131 scoped_refptr<ResourceRequestBody> body_; | 134 scoped_refptr<ResourceRequestBody> body_; |
| 132 ResourceContext* resource_context_; | 135 ResourceContext* resource_context_; |
| 133 base::Optional<base::TimeDelta> timeout_; | 136 base::Optional<base::TimeDelta> timeout_; |
| 134 | 137 |
| 135 base::WeakPtr<ServiceWorkerURLRequestJob> job_; | 138 base::WeakPtr<ServiceWorkerURLRequestJob> job_; |
| 136 scoped_refptr<ServiceWorkerVersion> target_worker_; | 139 scoped_refptr<ServiceWorkerVersion> target_worker_; |
| 137 | 140 |
| 138 // True if the next time this request is started, the response should be | 141 // True if the next time this request is started, the response should be |
| 139 // delivered from the network, bypassing the ServiceWorker. | 142 // delivered from the network, bypassing the ServiceWorker. |
| 140 bool use_network_ = false; | 143 bool use_network_ = false; |
| 141 | 144 |
| 142 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; | 145 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; |
| 143 | 146 |
| 144 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); | 147 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); |
| 145 }; | 148 }; |
| 146 | 149 |
| 147 } // namespace content | 150 } // namespace content |
| 148 | 151 |
| 149 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 152 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
| OLD | NEW |