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/frame_host/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 | 6 |
7 #include "base/debug/dump_without_crashing.h" | 7 #include "base/debug/dump_without_crashing.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/appcache/appcache_navigation_handle.h" |
| 10 #include "content/browser/appcache/appcache_service_impl.h" |
9 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 11 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 12 #include "content/browser/child_process_security_policy_impl.h" |
11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
12 #include "content/browser/frame_host/debug_urls.h" | 14 #include "content/browser/frame_host/debug_urls.h" |
13 #include "content/browser/frame_host/frame_tree_node.h" | 15 #include "content/browser/frame_host/frame_tree_node.h" |
14 #include "content/browser/frame_host/navigator.h" | 16 #include "content/browser/frame_host/navigator.h" |
15 #include "content/browser/frame_host/navigator_delegate.h" | 17 #include "content/browser/frame_host/navigator_delegate.h" |
16 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 18 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
17 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 19 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
18 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 20 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 return request_id_; | 408 return request_id_; |
407 } | 409 } |
408 | 410 |
409 void NavigationHandleImpl::InitServiceWorkerHandle( | 411 void NavigationHandleImpl::InitServiceWorkerHandle( |
410 ServiceWorkerContextWrapper* service_worker_context) { | 412 ServiceWorkerContextWrapper* service_worker_context) { |
411 DCHECK(IsBrowserSideNavigationEnabled()); | 413 DCHECK(IsBrowserSideNavigationEnabled()); |
412 service_worker_handle_.reset( | 414 service_worker_handle_.reset( |
413 new ServiceWorkerNavigationHandle(service_worker_context)); | 415 new ServiceWorkerNavigationHandle(service_worker_context)); |
414 } | 416 } |
415 | 417 |
| 418 void NavigationHandleImpl::InitAppCacheHandle( |
| 419 ChromeAppCacheService* appcache_service) { |
| 420 DCHECK(IsBrowserSideNavigationEnabled()); |
| 421 appcache_handle_.reset(new AppCacheNavigationHandle(appcache_service)); |
| 422 } |
| 423 |
416 void NavigationHandleImpl::WillStartRequest( | 424 void NavigationHandleImpl::WillStartRequest( |
417 const std::string& method, | 425 const std::string& method, |
418 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 426 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
419 const Referrer& sanitized_referrer, | 427 const Referrer& sanitized_referrer, |
420 ui::PageTransition transition, | 428 ui::PageTransition transition, |
421 bool is_external_protocol, | 429 bool is_external_protocol, |
422 RequestContextType request_context_type, | 430 RequestContextType request_context_type, |
423 const ThrottleChecksFinishedCallback& callback) { | 431 const ThrottleChecksFinishedCallback& callback) { |
424 if (method != "POST") | 432 if (method != "POST") |
425 DCHECK(!resource_request_body); | 433 DCHECK(!resource_request_body); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (result != NavigationThrottle::DEFER) | 527 if (result != NavigationThrottle::DEFER) |
520 RunCompleteCallback(result); | 528 RunCompleteCallback(result); |
521 } | 529 } |
522 | 530 |
523 void NavigationHandleImpl::ReadyToCommitNavigation( | 531 void NavigationHandleImpl::ReadyToCommitNavigation( |
524 RenderFrameHostImpl* render_frame_host) { | 532 RenderFrameHostImpl* render_frame_host) { |
525 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 533 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
526 render_frame_host_ = render_frame_host; | 534 render_frame_host_ = render_frame_host; |
527 state_ = READY_TO_COMMIT; | 535 state_ = READY_TO_COMMIT; |
528 | 536 |
| 537 if (appcache_handle_.get()) { |
| 538 appcache_handle_->CommitNavigation( |
| 539 render_frame_host->GetProcess()->GetID()); |
| 540 } |
| 541 |
529 if (!IsRendererDebugURL(url_)) | 542 if (!IsRendererDebugURL(url_)) |
530 GetDelegate()->ReadyToCommitNavigation(this); | 543 GetDelegate()->ReadyToCommitNavigation(this); |
531 } | 544 } |
532 | 545 |
533 void NavigationHandleImpl::DidCommitNavigation( | 546 void NavigationHandleImpl::DidCommitNavigation( |
534 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 547 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
535 bool same_page, | 548 bool same_page, |
536 RenderFrameHostImpl* render_frame_host) { | 549 RenderFrameHostImpl* render_frame_host) { |
537 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 550 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
538 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 551 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 801 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
789 | 802 |
790 if (throttles_to_register.size() > 0) { | 803 if (throttles_to_register.size() > 0) { |
791 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 804 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
792 throttles_to_register.end()); | 805 throttles_to_register.end()); |
793 throttles_to_register.weak_clear(); | 806 throttles_to_register.weak_clear(); |
794 } | 807 } |
795 } | 808 } |
796 | 809 |
797 } // namespace content | 810 } // namespace content |
OLD | NEW |