Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: content/browser/service_worker/foreign_fetch_request_handler.cc

Issue 2954343005: Merge ResourceRequestBodyImpl and ResourceRequestBody. (Closed)
Patch Set: Remove comment Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/browser/service_worker/foreign_fetch_request_handler.h" 5 #include "content/browser/service_worker/foreign_fetch_request_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "content/browser/service_worker/service_worker_context_wrapper.h" 14 #include "content/browser/service_worker/service_worker_context_wrapper.h"
15 #include "content/browser/service_worker/service_worker_response_info.h" 15 #include "content/browser/service_worker/service_worker_response_info.h"
16 #include "content/browser/service_worker/service_worker_url_request_job.h" 16 #include "content/browser/service_worker/service_worker_url_request_job.h"
17 #include "content/common/resource_request_body_impl.h"
18 #include "content/common/service_worker/service_worker_types.h" 17 #include "content/common/service_worker/service_worker_types.h"
19 #include "content/common/service_worker/service_worker_utils.h" 18 #include "content/common/service_worker/service_worker_utils.h"
20 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
21 #include "content/public/browser/resource_request_info.h" 20 #include "content/public/browser/resource_request_info.h"
22 #include "content/public/common/content_client.h" 21 #include "content/public/common/content_client.h"
23 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
24 #include "content/public/common/origin_trial_policy.h" 23 #include "content/public/common/origin_trial_policy.h"
24 #include "content/public/common/resource_request_body.h"
25 #include "net/url_request/url_request.h" 25 #include "net/url_request/url_request.h"
26 #include "net/url_request/url_request_interceptor.h" 26 #include "net/url_request/url_request_interceptor.h"
27 #include "storage/browser/blob/blob_storage_context.h" 27 #include "storage/browser/blob/blob_storage_context.h"
28 28
29 namespace content { 29 namespace content {
30 30
31 namespace { 31 namespace {
32 32
33 int kUserDataKey; // Only address is used. 33 int kUserDataKey; // Only address is used.
34 34
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 storage::BlobStorageContext* blob_storage_context, 72 storage::BlobStorageContext* blob_storage_context,
73 int process_id, 73 int process_id,
74 int provider_id, 74 int provider_id,
75 ServiceWorkerMode service_worker_mode, 75 ServiceWorkerMode service_worker_mode,
76 FetchRequestMode request_mode, 76 FetchRequestMode request_mode,
77 FetchCredentialsMode credentials_mode, 77 FetchCredentialsMode credentials_mode,
78 FetchRedirectMode redirect_mode, 78 FetchRedirectMode redirect_mode,
79 ResourceType resource_type, 79 ResourceType resource_type,
80 RequestContextType request_context_type, 80 RequestContextType request_context_type,
81 RequestContextFrameType frame_type, 81 RequestContextFrameType frame_type,
82 scoped_refptr<ResourceRequestBodyImpl> body, 82 scoped_refptr<ResourceRequestBody> body,
83 bool initiated_in_secure_context) { 83 bool initiated_in_secure_context) {
84 if (!IsForeignFetchEnabled()) 84 if (!IsForeignFetchEnabled())
85 return; 85 return;
86 86
87 if (!context_wrapper || !context_wrapper->context() || 87 if (!context_wrapper || !context_wrapper->context() ||
88 provider_id == kInvalidServiceWorkerProviderId) { 88 provider_id == kInvalidServiceWorkerProviderId) {
89 return; 89 return;
90 } 90 }
91 91
92 if (service_worker_mode == ServiceWorkerMode::NONE) 92 if (service_worker_mode == ServiceWorkerMode::NONE)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 ForeignFetchRequestHandler::ForeignFetchRequestHandler( 198 ForeignFetchRequestHandler::ForeignFetchRequestHandler(
199 ServiceWorkerContextWrapper* context, 199 ServiceWorkerContextWrapper* context,
200 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 200 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
201 FetchRequestMode request_mode, 201 FetchRequestMode request_mode,
202 FetchCredentialsMode credentials_mode, 202 FetchCredentialsMode credentials_mode,
203 FetchRedirectMode redirect_mode, 203 FetchRedirectMode redirect_mode,
204 ResourceType resource_type, 204 ResourceType resource_type,
205 RequestContextType request_context_type, 205 RequestContextType request_context_type,
206 RequestContextFrameType frame_type, 206 RequestContextFrameType frame_type,
207 scoped_refptr<ResourceRequestBodyImpl> body, 207 scoped_refptr<ResourceRequestBody> body,
208 const base::Optional<base::TimeDelta>& timeout) 208 const base::Optional<base::TimeDelta>& timeout)
209 : context_(context), 209 : context_(context),
210 blob_storage_context_(blob_storage_context), 210 blob_storage_context_(blob_storage_context),
211 resource_type_(resource_type), 211 resource_type_(resource_type),
212 request_mode_(request_mode), 212 request_mode_(request_mode),
213 credentials_mode_(credentials_mode), 213 credentials_mode_(credentials_mode),
214 redirect_mode_(redirect_mode), 214 redirect_mode_(redirect_mode),
215 request_context_type_(request_context_type), 215 request_context_type_(request_context_type),
216 frame_type_(frame_type), 216 frame_type_(frame_type),
217 body_(body), 217 body_(body),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // The worker entry in the database was written by old version Chrome (< M56) 305 // The worker entry in the database was written by old version Chrome (< M56)
306 // and the main script was not loaded yet. In this case, we can't check the 306 // and the main script was not loaded yet. In this case, we can't check the
307 // origin trial token. 307 // origin trial token.
308 if (!active_version->origin_trial_tokens()) 308 if (!active_version->origin_trial_tokens())
309 return true; 309 return true;
310 const auto& token_map = *active_version->origin_trial_tokens(); 310 const auto& token_map = *active_version->origin_trial_tokens();
311 return base::ContainsKey(token_map, "ForeignFetch"); 311 return base::ContainsKey(token_map, "ForeignFetch");
312 } 312 }
313 313
314 } // namespace content 314 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698