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

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

Issue 2982363002: Add support for fallback content for the frame. This includes main and subframes. (Closed)
Patch Set: Address review comments. Add the fallback function as a parameter to LoaderCallback Created 3 years, 4 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 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 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void ServiceWorkerControlleeRequestHandler::MaybeCreateLoader( 195 void ServiceWorkerControlleeRequestHandler::MaybeCreateLoader(
196 const ResourceRequest& resource_request, 196 const ResourceRequest& resource_request,
197 ResourceContext* resource_context, 197 ResourceContext* resource_context,
198 LoaderCallback callback) { 198 LoaderCallback callback) {
199 DCHECK(ServiceWorkerUtils::IsServicificationEnabled()); 199 DCHECK(ServiceWorkerUtils::IsServicificationEnabled());
200 DCHECK(is_main_resource_load_); 200 DCHECK(is_main_resource_load_);
201 ClearJob(); 201 ClearJob();
202 202
203 if (!context_ || !provider_host_) { 203 if (!context_ || !provider_host_) {
204 // We can't do anything other than to fall back to network. 204 // We can't do anything other than to fall back to network.
205 std::move(callback).Run(StartLoaderCallback()); 205 std::move(callback).Run(StartLoaderCallback(), ResponseFallback());
206 return; 206 return;
207 } 207 }
208 208
209 // In fallback cases we basically 'forward' the request, so we should 209 // In fallback cases we basically 'forward' the request, so we should
210 // never see use_network_ gets true. 210 // never see use_network_ gets true.
211 DCHECK(!use_network_); 211 DCHECK(!use_network_);
212 212
213 #if BUILDFLAG(ENABLE_OFFLINE_PAGES) 213 #if BUILDFLAG(ENABLE_OFFLINE_PAGES)
214 // Fall back for the subsequent offline page interceptor to load the offline 214 // Fall back for the subsequent offline page interceptor to load the offline
215 // snapshot of the page if required. 215 // snapshot of the page if required.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 void ServiceWorkerControlleeRequestHandler::ClearJob() { 542 void ServiceWorkerControlleeRequestHandler::ClearJob() {
543 url_job_.reset(); 543 url_job_.reset();
544 } 544 }
545 545
546 bool ServiceWorkerControlleeRequestHandler::JobWasCanceled() const { 546 bool ServiceWorkerControlleeRequestHandler::JobWasCanceled() const {
547 return !url_job_ || url_job_->WasCanceled(); 547 return !url_job_ || url_job_->WasCanceled();
548 } 548 }
549 549
550 } // namespace content 550 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698