Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 GetProcess()->FilterURL(false, &validated_url); | 519 GetProcess()->FilterURL(false, &validated_url); |
| 520 | 520 |
| 521 frame_tree_node_->navigator()->DidFailLoadWithError( | 521 frame_tree_node_->navigator()->DidFailLoadWithError( |
| 522 this, validated_url, error_code, error_description); | 522 this, validated_url, error_code, error_description); |
| 523 } | 523 } |
| 524 | 524 |
| 525 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( | 525 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( |
| 526 int32 page_id, | 526 int32 page_id, |
| 527 const GURL& source_url, | 527 const GURL& source_url, |
| 528 const GURL& target_url) { | 528 const GURL& target_url) { |
| 529 CHECK_EQ(render_view_host_->page_id_, page_id); | |
|
Tom Sepez
2014/08/07 17:07:51
Would prefer not to crash the browser here, instea
Charlie Reis
2014/08/07 17:38:00
That wouldn't let us see the cause of the kill in
Avi (use Gerrit)
2014/08/07 18:37:06
I was thinking about crash keys, but that's in the
| |
| 529 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( | 530 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( |
| 530 this, page_id, source_url, target_url); | 531 this, render_view_host_->page_id_, source_url, target_url); |
| 531 } | 532 } |
| 532 | 533 |
| 533 // Called when the renderer navigates. For every frame loaded, we'll get this | 534 // Called when the renderer navigates. For every frame loaded, we'll get this |
| 534 // notification containing parameters identifying the navigation. | 535 // notification containing parameters identifying the navigation. |
| 535 // | 536 // |
| 536 // Subframes are identified by the page transition type. For subframes loaded | 537 // Subframes are identified by the page transition type. For subframes loaded |
| 537 // as part of a wider page load, the page_id will be the same as for the top | 538 // as part of a wider page load, the page_id will be the same as for the top |
| 538 // level frame. If the user explicitly requests a subframe navigation, we will | 539 // level frame. If the user explicitly requests a subframe navigation, we will |
| 539 // get a new page_id because we need to create a new navigation entry for that | 540 // get a new page_id because we need to create a new navigation entry for that |
| 540 // action. | 541 // action. |
| 541 void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) { | 542 void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) { |
| 542 // Read the parameters out of the IPC message directly to avoid making another | 543 // Read the parameters out of the IPC message directly to avoid making another |
| 543 // copy when we filter the URLs. | 544 // copy when we filter the URLs. |
| 544 PickleIterator iter(msg); | 545 PickleIterator iter(msg); |
| 545 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; | 546 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; |
| 546 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: | 547 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: |
| 547 Read(&msg, &iter, &validated_params)) | 548 Read(&msg, &iter, &validated_params)) |
| 548 return; | 549 return; |
| 549 | 550 |
| 551 // Update the RVH's current page ID so that other IPCs make sense. | |
|
Charlie Reis
2014/08/07 17:01:20
Let's fix my wording from the draft CL:
// Update
Avi (use Gerrit)
2014/08/07 18:37:06
Done.
| |
| 552 render_view_host_->page_id_ = validated_params.page_id; | |
| 553 | |
| 550 // If we're waiting for a cross-site beforeunload ack from this renderer and | 554 // If we're waiting for a cross-site beforeunload ack from this renderer and |
| 551 // we receive a Navigate message from the main frame, then the renderer was | 555 // we receive a Navigate message from the main frame, then the renderer was |
| 552 // navigating already and sent it before hearing the ViewMsg_Stop message. | 556 // navigating already and sent it before hearing the ViewMsg_Stop message. |
| 553 // We do not want to cancel the pending navigation in this case, since the | 557 // We do not want to cancel the pending navigation in this case, since the |
| 554 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 558 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
| 555 // to allow the pending navigation to continue. | 559 // to allow the pending navigation to continue. |
| 556 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 560 if (render_view_host_->is_waiting_for_beforeunload_ack_ && |
| 557 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 561 render_view_host_->unload_ack_is_for_cross_site_transition_ && |
| 558 PageTransitionIsMainFrame(validated_params.transition)) { | 562 PageTransitionIsMainFrame(validated_params.transition)) { |
| 559 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 563 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 852 void RenderFrameHostImpl::OnDidDisownOpener() { | 856 void RenderFrameHostImpl::OnDidDisownOpener() { |
| 853 // This message is only sent for top-level frames. TODO(avi): when frame tree | 857 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 854 // mirroring works correctly, add a check here to enforce it. | 858 // mirroring works correctly, add a check here to enforce it. |
| 855 delegate_->DidDisownOpener(this); | 859 delegate_->DidDisownOpener(this); |
| 856 } | 860 } |
| 857 | 861 |
| 858 void RenderFrameHostImpl::OnUpdateTitle( | 862 void RenderFrameHostImpl::OnUpdateTitle( |
| 859 int32 page_id, | 863 int32 page_id, |
| 860 const base::string16& title, | 864 const base::string16& title, |
| 861 blink::WebTextDirection title_direction) { | 865 blink::WebTextDirection title_direction) { |
| 866 CHECK_EQ(render_view_host_->page_id_, page_id); | |
|
Tom Sepez
2014/08/07 17:07:51
avoid browser crash here, too, kill renderer.
| |
| 862 // This message is only sent for top-level frames. TODO(avi): when frame tree | 867 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 863 // mirroring works correctly, add a check here to enforce it. | 868 // mirroring works correctly, add a check here to enforce it. |
| 864 if (title.length() > kMaxTitleChars) { | 869 if (title.length() > kMaxTitleChars) { |
| 865 NOTREACHED() << "Renderer sent too many characters in title."; | 870 NOTREACHED() << "Renderer sent too many characters in title."; |
| 866 return; | 871 return; |
| 867 } | 872 } |
| 868 | 873 |
| 869 delegate_->UpdateTitle(this, page_id, title, | 874 delegate_->UpdateTitle(this, render_view_host_->page_id_, title, |
| 870 WebTextDirectionToChromeTextDirection( | 875 WebTextDirectionToChromeTextDirection( |
| 871 title_direction)); | 876 title_direction)); |
| 872 } | 877 } |
| 873 | 878 |
| 874 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { | 879 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { |
| 875 // This message is only sent for top-level frames. TODO(avi): when frame tree | 880 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 876 // mirroring works correctly, add a check here to enforce it. | 881 // mirroring works correctly, add a check here to enforce it. |
| 877 delegate_->UpdateEncoding(this, encoding_name); | 882 delegate_->UpdateEncoding(this, encoding_name); |
| 878 } | 883 } |
| 879 | 884 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1171 FROM_HERE, | 1176 FROM_HERE, |
| 1172 base::Bind( | 1177 base::Bind( |
| 1173 &TransitionRequestManager::SetHasPendingTransitionRequest, | 1178 &TransitionRequestManager::SetHasPendingTransitionRequest, |
| 1174 base::Unretained(TransitionRequestManager::GetInstance()), | 1179 base::Unretained(TransitionRequestManager::GetInstance()), |
| 1175 GetProcess()->GetID(), | 1180 GetProcess()->GetID(), |
| 1176 routing_id_, | 1181 routing_id_, |
| 1177 has_pending_request)); | 1182 has_pending_request)); |
| 1178 } | 1183 } |
| 1179 | 1184 |
| 1180 } // namespace content | 1185 } // namespace content |
| OLD | NEW |