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 #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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 if (!scope_matches || !origin_matches) { | 252 if (!scope_matches || !origin_matches) { |
253 job->FallbackToNetwork(); | 253 job->FallbackToNetwork(); |
254 return; | 254 return; |
255 } | 255 } |
256 | 256 |
257 if (!IsForeignFetchEnabled() && !CheckOriginTrialToken(active_version)) { | 257 if (!IsForeignFetchEnabled() && !CheckOriginTrialToken(active_version)) { |
258 job->FallbackToNetwork(); | 258 job->FallbackToNetwork(); |
259 return; | 259 return; |
260 } | 260 } |
261 | 261 |
262 auto request_info = ResourceRequestInfo::ForRequest(job->request()); | 262 auto* request_info = ResourceRequestInfo::ForRequest(job->request()); |
263 base::Callback<WebContents*(void)> web_contents_getter; | 263 base::Callback<WebContents*(void)> web_contents_getter; |
264 if (request_info) | 264 if (request_info) |
265 web_contents_getter = request_info->GetWebContentsGetterForRequest(); | 265 web_contents_getter = request_info->GetWebContentsGetterForRequest(); |
266 | 266 |
267 if (!GetContentClient()->browser()->AllowServiceWorker( | 267 if (!GetContentClient()->browser()->AllowServiceWorker( |
268 registration->pattern(), job->request()->first_party_for_cookies(), | 268 registration->pattern(), job->request()->first_party_for_cookies(), |
269 resource_context_, web_contents_getter)) { | 269 resource_context_, web_contents_getter)) { |
270 job->FallbackToNetwork(); | 270 job->FallbackToNetwork(); |
271 return; | 271 return; |
272 } | 272 } |
(...skipping 30 matching lines...) Expand all Loading... |
303 // The worker entry in the database was written by old version Chrome (< M56) | 303 // The worker entry in the database was written by old version Chrome (< M56) |
304 // and the main script was not loaded yet. In this case, we can't check the | 304 // and the main script was not loaded yet. In this case, we can't check the |
305 // origin trial token. | 305 // origin trial token. |
306 if (!active_version->origin_trial_tokens()) | 306 if (!active_version->origin_trial_tokens()) |
307 return true; | 307 return true; |
308 const auto& token_map = *active_version->origin_trial_tokens(); | 308 const auto& token_map = *active_version->origin_trial_tokens(); |
309 return base::ContainsKey(token_map, "ForeignFetch"); | 309 return base::ContainsKey(token_map, "ForeignFetch"); |
310 } | 310 } |
311 | 311 |
312 } // namespace content | 312 } // namespace content |
OLD | NEW |