| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } | 635 } |
| 636 | 636 |
| 637 void RenderFrameHostImpl::OnDetach() { | 637 void RenderFrameHostImpl::OnDetach() { |
| 638 frame_tree_->RemoveFrame(frame_tree_node_); | 638 frame_tree_->RemoveFrame(frame_tree_node_); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void RenderFrameHostImpl::OnFrameFocused() { | 641 void RenderFrameHostImpl::OnFrameFocused() { |
| 642 frame_tree_->SetFocusedFrame(frame_tree_node_); | 642 frame_tree_->SetFocusedFrame(frame_tree_node_); |
| 643 } | 643 } |
| 644 | 644 |
| 645 void RenderFrameHostImpl::OnOpenURL( | 645 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { |
| 646 const FrameHostMsg_OpenURL_Params& params) { | 646 OpenURL(params, nullptr); |
| 647 GURL validated_url(params.url); | |
| 648 GetProcess()->FilterURL(false, &validated_url); | |
| 649 | |
| 650 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnOpenURL", | |
| 651 "url", validated_url.possibly_invalid_spec()); | |
| 652 frame_tree_node_->navigator()->RequestOpenURL( | |
| 653 this, validated_url, params.referrer, params.disposition, | |
| 654 params.should_replace_current_entry, params.user_gesture); | |
| 655 } | 647 } |
| 656 | 648 |
| 657 void RenderFrameHostImpl::OnDocumentOnLoadCompleted() { | 649 void RenderFrameHostImpl::OnDocumentOnLoadCompleted() { |
| 658 // This message is only sent for top-level frames. TODO(avi): when frame tree | 650 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 659 // mirroring works correctly, add a check here to enforce it. | 651 // mirroring works correctly, add a check here to enforce it. |
| 660 delegate_->DocumentOnLoadCompleted(this); | 652 delegate_->DocumentOnLoadCompleted(this); |
| 661 } | 653 } |
| 662 | 654 |
| 663 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( | 655 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( |
| 664 const GURL& url, | 656 const GURL& url, |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 params.common_params.transition = ui::PAGE_TRANSITION_LINK; | 1350 params.common_params.transition = ui::PAGE_TRANSITION_LINK; |
| 1359 params.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1351 params.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 1360 params.commit_params.browser_navigation_start = base::TimeTicks::Now(); | 1352 params.commit_params.browser_navigation_start = base::TimeTicks::Now(); |
| 1361 params.page_id = -1; | 1353 params.page_id = -1; |
| 1362 params.pending_history_list_offset = -1; | 1354 params.pending_history_list_offset = -1; |
| 1363 params.current_history_list_offset = -1; | 1355 params.current_history_list_offset = -1; |
| 1364 params.current_history_list_length = 0; | 1356 params.current_history_list_length = 0; |
| 1365 Navigate(params); | 1357 Navigate(params); |
| 1366 } | 1358 } |
| 1367 | 1359 |
| 1368 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params) { | 1360 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
| 1369 OnOpenURL(params); | 1361 SiteInstance* site_instance) { |
| 1362 GURL validated_url(params.url); |
| 1363 GetProcess()->FilterURL(false, &validated_url); |
| 1364 |
| 1365 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnOpenURL", "url", |
| 1366 validated_url.possibly_invalid_spec()); |
| 1367 frame_tree_node_->navigator()->RequestOpenURL( |
| 1368 this, validated_url, site_instance, params.referrer, params.disposition, |
| 1369 params.should_replace_current_entry, params.user_gesture); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 void RenderFrameHostImpl::Stop() { | 1372 void RenderFrameHostImpl::Stop() { |
| 1373 Send(new FrameMsg_Stop(routing_id_)); | 1373 Send(new FrameMsg_Stop(routing_id_)); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1376 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
| 1377 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 1377 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
| 1378 // the handler ran and allowed the navigation to proceed. | 1378 // the handler ran and allowed the navigation to proceed. |
| 1379 if (GetParent() || !IsRenderFrameLive()) { | 1379 if (GetParent() || !IsRenderFrameLive()) { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1684 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
| 1685 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1685 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
| 1686 GetContentClient()->browser()->RegisterPermissionUsage( | 1686 GetContentClient()->browser()->RegisterPermissionUsage( |
| 1687 PERMISSION_GEOLOCATION, | 1687 PERMISSION_GEOLOCATION, |
| 1688 delegate_->GetAsWebContents(), | 1688 delegate_->GetAsWebContents(), |
| 1689 GetLastCommittedURL().GetOrigin(), | 1689 GetLastCommittedURL().GetOrigin(), |
| 1690 top_frame->GetLastCommittedURL().GetOrigin()); | 1690 top_frame->GetLastCommittedURL().GetOrigin()); |
| 1691 } | 1691 } |
| 1692 | 1692 |
| 1693 } // namespace content | 1693 } // namespace content |
| OLD | NEW |