Chromium Code Reviews| 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 bool has_user_gesture, | 428 bool has_user_gesture, |
| 421 ui::PageTransition transition, | 429 ui::PageTransition transition, |
| 422 bool is_external_protocol, | 430 bool is_external_protocol, |
| 423 RequestContextType request_context_type, | 431 RequestContextType request_context_type, |
| 424 const ThrottleChecksFinishedCallback& callback) { | 432 const ThrottleChecksFinishedCallback& callback) { |
| 425 // |method != "POST"| should imply absence of |resource_request_body|. | 433 // |method != "POST"| should imply absence of |resource_request_body|. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 if (result != NavigationThrottle::DEFER) | 532 if (result != NavigationThrottle::DEFER) |
| 525 RunCompleteCallback(result); | 533 RunCompleteCallback(result); |
| 526 } | 534 } |
| 527 | 535 |
| 528 void NavigationHandleImpl::ReadyToCommitNavigation( | 536 void NavigationHandleImpl::ReadyToCommitNavigation( |
| 529 RenderFrameHostImpl* render_frame_host) { | 537 RenderFrameHostImpl* render_frame_host) { |
| 530 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 538 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 531 render_frame_host_ = render_frame_host; | 539 render_frame_host_ = render_frame_host; |
| 532 state_ = READY_TO_COMMIT; | 540 state_ = READY_TO_COMMIT; |
| 533 | 541 |
| 542 if (appcache_handle_.get()) { | |
|
clamy
2016/11/25 13:32:24
Note: at this point we have not committed the navi
ananta
2016/11/28 21:36:53
Yes. If the RFH is not going to change from this p
| |
| 543 appcache_handle_->CommitNavigation( | |
| 544 render_frame_host->GetProcess()->GetID()); | |
| 545 } | |
| 546 | |
| 534 if (!IsRendererDebugURL(url_)) | 547 if (!IsRendererDebugURL(url_)) |
| 535 GetDelegate()->ReadyToCommitNavigation(this); | 548 GetDelegate()->ReadyToCommitNavigation(this); |
| 536 } | 549 } |
| 537 | 550 |
| 538 void NavigationHandleImpl::DidCommitNavigation( | 551 void NavigationHandleImpl::DidCommitNavigation( |
| 539 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 552 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 540 bool same_page, | 553 bool same_page, |
| 541 RenderFrameHostImpl* render_frame_host) { | 554 RenderFrameHostImpl* render_frame_host) { |
| 542 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 555 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 543 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 556 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 800 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 788 | 801 |
| 789 if (throttles_to_register.size() > 0) { | 802 if (throttles_to_register.size() > 0) { |
| 790 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 803 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 791 throttles_to_register.end()); | 804 throttles_to_register.end()); |
| 792 throttles_to_register.weak_clear(); | 805 throttles_to_register.weak_clear(); |
| 793 } | 806 } |
| 794 } | 807 } |
| 795 | 808 |
| 796 } // namespace content | 809 } // namespace content |
| OLD | NEW |