| 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/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 struct ResourceResponseInfo; | 39 struct ResourceResponseInfo; |
| 40 | 40 |
| 41 // Class for routing network requests to ServiceWorkers for foreign fetch | 41 // Class for routing network requests to ServiceWorkers for foreign fetch |
| 42 // events. Created one per URLRequest and attached to each request. | 42 // events. Created one per URLRequest and attached to each request. |
| 43 // TODO(mek): Does this need something similar to ServiceWorkerRequestHandler's | 43 // TODO(mek): Does this need something similar to ServiceWorkerRequestHandler's |
| 44 // GetExtraResponseInfo method? | 44 // GetExtraResponseInfo method? |
| 45 class CONTENT_EXPORT ForeignFetchRequestHandler | 45 class CONTENT_EXPORT ForeignFetchRequestHandler |
| 46 : public base::SupportsUserData::Data, | 46 : public base::SupportsUserData::Data, |
| 47 public ServiceWorkerURLRequestJob::Delegate { | 47 public ServiceWorkerURLRequestJob::Delegate { |
| 48 public: | 48 public: |
| 49 // Returns true if Foreign Fetch is enabled. Foreign Fetch is considered to be |
| 50 // enabled if an OriginTrialPolicy exists, and that policy doesn't disable the |
| 51 // feature. When the policy does disable the feature, that can be overridden |
| 52 // with the experimental web platform features command line flag. |
| 53 static bool IsForeignFetchEnabled(); |
| 54 |
| 49 // Attaches a newly created handler if the given |request| needs to | 55 // Attaches a newly created handler if the given |request| needs to |
| 50 // be handled by a foreign fetch handling ServiceWorker. | 56 // be handled by a foreign fetch handling ServiceWorker. |
| 51 static void InitializeHandler( | 57 static void InitializeHandler( |
| 52 net::URLRequest* request, | 58 net::URLRequest* request, |
| 53 ServiceWorkerContextWrapper* context_wrapper, | 59 ServiceWorkerContextWrapper* context_wrapper, |
| 54 storage::BlobStorageContext* blob_storage_context, | 60 storage::BlobStorageContext* blob_storage_context, |
| 55 int process_id, | 61 int process_id, |
| 56 int provider_id, | 62 int provider_id, |
| 57 SkipServiceWorker skip_service_worker, | 63 SkipServiceWorker skip_service_worker, |
| 58 FetchRequestMode request_mode, | 64 FetchRequestMode request_mode, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 bool use_network_ = false; | 131 bool use_network_ = false; |
| 126 | 132 |
| 127 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; | 133 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; |
| 128 | 134 |
| 129 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); | 135 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); |
| 130 }; | 136 }; |
| 131 | 137 |
| 132 } // namespace content | 138 } // namespace content |
| 133 | 139 |
| 134 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ | 140 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ |
| OLD | NEW |