OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/appcache/appcache_request_handler.h" | 5 #include "content/browser/appcache/appcache_request_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "content/browser/appcache/appcache.h" | 10 #include "content/browser/appcache/appcache.h" |
11 #include "content/browser/appcache/appcache_backend_impl.h" | 11 #include "content/browser/appcache/appcache_backend_impl.h" |
12 #include "content/browser/appcache/appcache_network_service_handler.h" | |
13 #include "content/browser/appcache/appcache_policy.h" | 12 #include "content/browser/appcache/appcache_policy.h" |
14 #include "content/browser/appcache/appcache_request.h" | 13 #include "content/browser/appcache/appcache_request.h" |
15 #include "content/browser/appcache/appcache_url_request_job.h" | 14 #include "content/browser/appcache/appcache_url_request_job.h" |
16 #include "content/browser/service_worker/service_worker_request_handler.h" | 15 #include "content/browser/service_worker/service_worker_request_handler.h" |
17 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
18 #include "net/url_request/url_request_job.h" | 17 #include "net/url_request/url_request_job.h" |
19 | 18 |
20 namespace content { | 19 namespace content { |
21 | 20 |
22 AppCacheRequestHandler::AppCacheRequestHandler( | 21 AppCacheRequestHandler::AppCacheRequestHandler( |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 216 |
218 void AppCacheRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( | 217 void AppCacheRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( |
219 int old_process_id) { | 218 int old_process_id) { |
220 if (!host_ || !host_for_cross_site_transfer_.get() || | 219 if (!host_ || !host_for_cross_site_transfer_.get() || |
221 old_process_id != old_process_id_) { | 220 old_process_id != old_process_id_) { |
222 return; | 221 return; |
223 } | 222 } |
224 CompleteCrossSiteTransfer(old_process_id_, old_host_id_); | 223 CompleteCrossSiteTransfer(old_process_id_, old_host_id_); |
225 } | 224 } |
226 | 225 |
227 // static. | |
228 void AppCacheRequestHandler::InitializeForNavigationNetworkService( | |
229 std::unique_ptr<ResourceRequest> resource_request, | |
230 ResourceContext* resource_context, | |
231 AppCacheNavigationHandleCore* navigation_handle_core, | |
232 ResourceType resource_type, | |
233 base::Callback<void(mojom::URLLoaderFactoryPtrInfo, | |
234 std::unique_ptr<ResourceRequest>)> callback) { | |
235 // This instance is deleted when it receives a callback from the | |
236 // AppCacheStorage class which contains information about the AppCache | |
237 // status for the URL being served by the |resource_request|. | |
238 AppCacheNetworkServiceHandler* network_service_handler = | |
239 new AppCacheNetworkServiceHandler( | |
240 std::move(resource_request), navigation_handle_core, callback); | |
241 network_service_handler->Start(); | |
242 } | |
243 | |
244 void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) { | 226 void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) { |
245 storage()->CancelDelegateCallbacks(this); | 227 storage()->CancelDelegateCallbacks(this); |
246 host_ = NULL; // no need to RemoveObserver, the host is being deleted | 228 host_ = NULL; // no need to RemoveObserver, the host is being deleted |
247 | 229 |
248 // Since the host is being deleted, we don't have to complete any job | 230 // Since the host is being deleted, we don't have to complete any job |
249 // that is current running. It's destined for the bit bucket anyway. | 231 // that is current running. It's destined for the bit bucket anyway. |
250 if (job_.get()) { | 232 if (job_.get()) { |
251 job_->Kill(); | 233 job_->Kill(); |
252 job_.reset(); | 234 job_.reset(); |
253 } | 235 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 if (!host_->associated_cache() || | 497 if (!host_->associated_cache() || |
516 !host_->associated_cache()->is_complete()) { | 498 !host_->associated_cache()->is_complete()) { |
517 DeliverNetworkResponse(); | 499 DeliverNetworkResponse(); |
518 return; | 500 return; |
519 } | 501 } |
520 | 502 |
521 ContinueMaybeLoadSubResource(); | 503 ContinueMaybeLoadSubResource(); |
522 } | 504 } |
523 | 505 |
524 } // namespace content | 506 } // namespace content |
OLD | NEW |