| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 579 } |
| 580 | 580 |
| 581 void RenderFrameHostImpl::OnDetach() { | 581 void RenderFrameHostImpl::OnDetach() { |
| 582 frame_tree_->RemoveFrame(frame_tree_node_); | 582 frame_tree_->RemoveFrame(frame_tree_node_); |
| 583 } | 583 } |
| 584 | 584 |
| 585 void RenderFrameHostImpl::OnFrameFocused() { | 585 void RenderFrameHostImpl::OnFrameFocused() { |
| 586 frame_tree_->SetFocusedFrame(frame_tree_node_); | 586 frame_tree_->SetFocusedFrame(frame_tree_node_); |
| 587 } | 587 } |
| 588 | 588 |
| 589 void RenderFrameHostImpl::OnOpenURL( | 589 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { |
| 590 const FrameHostMsg_OpenURL_Params& params) { | 590 OpenURL(params, GetSiteInstance()); |
| 591 GURL validated_url(params.url); | |
| 592 GetProcess()->FilterURL(false, &validated_url); | |
| 593 | |
| 594 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnOpenURL", | |
| 595 "url", validated_url.possibly_invalid_spec()); | |
| 596 frame_tree_node_->navigator()->RequestOpenURL( | |
| 597 this, validated_url, params.referrer, params.disposition, | |
| 598 params.should_replace_current_entry, params.user_gesture); | |
| 599 } | 591 } |
| 600 | 592 |
| 601 void RenderFrameHostImpl::OnDocumentOnLoadCompleted( | 593 void RenderFrameHostImpl::OnDocumentOnLoadCompleted( |
| 602 FrameMsg_UILoadMetricsReportType::Value report_type, | 594 FrameMsg_UILoadMetricsReportType::Value report_type, |
| 603 base::TimeTicks ui_timestamp) { | 595 base::TimeTicks ui_timestamp) { |
| 604 if (report_type == FrameMsg_UILoadMetricsReportType::REPORT_LINK) { | 596 if (report_type == FrameMsg_UILoadMetricsReportType::REPORT_LINK) { |
| 605 UMA_HISTOGRAM_TIMES("Navigation.UI_OnLoadComplete.Link", | 597 UMA_HISTOGRAM_TIMES("Navigation.UI_OnLoadComplete.Link", |
| 606 base::TimeTicks::Now() - ui_timestamp); | 598 base::TimeTicks::Now() - ui_timestamp); |
| 607 } | 599 } |
| 608 // This message is only sent for top-level frames. TODO(avi): when frame tree | 600 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 params.common_params.transition = ui::PAGE_TRANSITION_LINK; | 1286 params.common_params.transition = ui::PAGE_TRANSITION_LINK; |
| 1295 params.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1287 params.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 1296 params.commit_params.browser_navigation_start = base::TimeTicks::Now(); | 1288 params.commit_params.browser_navigation_start = base::TimeTicks::Now(); |
| 1297 params.page_id = -1; | 1289 params.page_id = -1; |
| 1298 params.pending_history_list_offset = -1; | 1290 params.pending_history_list_offset = -1; |
| 1299 params.current_history_list_offset = -1; | 1291 params.current_history_list_offset = -1; |
| 1300 params.current_history_list_length = 0; | 1292 params.current_history_list_length = 0; |
| 1301 Navigate(params); | 1293 Navigate(params); |
| 1302 } | 1294 } |
| 1303 | 1295 |
| 1304 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params) { | 1296 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
| 1305 OnOpenURL(params); | 1297 SiteInstance* source_site_instance) { |
| 1298 GURL validated_url(params.url); |
| 1299 GetProcess()->FilterURL(false, &validated_url); |
| 1300 |
| 1301 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", |
| 1302 validated_url.possibly_invalid_spec()); |
| 1303 frame_tree_node_->navigator()->RequestOpenURL( |
| 1304 this, validated_url, source_site_instance, params.referrer, |
| 1305 params.disposition, params.should_replace_current_entry, |
| 1306 params.user_gesture); |
| 1306 } | 1307 } |
| 1307 | 1308 |
| 1308 void RenderFrameHostImpl::Stop() { | 1309 void RenderFrameHostImpl::Stop() { |
| 1309 Send(new FrameMsg_Stop(routing_id_)); | 1310 Send(new FrameMsg_Stop(routing_id_)); |
| 1310 } | 1311 } |
| 1311 | 1312 |
| 1312 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1313 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
| 1313 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 1314 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
| 1314 // the handler ran and allowed the navigation to proceed. | 1315 // the handler ran and allowed the navigation to proceed. |
| 1315 if (GetParent() || !IsRenderFrameLive()) { | 1316 if (GetParent() || !IsRenderFrameLive()) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1606 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
| 1606 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1607 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
| 1607 GetContentClient()->browser()->RegisterPermissionUsage( | 1608 GetContentClient()->browser()->RegisterPermissionUsage( |
| 1608 PERMISSION_GEOLOCATION, | 1609 PERMISSION_GEOLOCATION, |
| 1609 delegate_->GetAsWebContents(), | 1610 delegate_->GetAsWebContents(), |
| 1610 GetLastCommittedURL().GetOrigin(), | 1611 GetLastCommittedURL().GetOrigin(), |
| 1611 top_frame->GetLastCommittedURL().GetOrigin()); | 1612 top_frame->GetLastCommittedURL().GetOrigin()); |
| 1612 } | 1613 } |
| 1613 | 1614 |
| 1614 } // namespace content | 1615 } // namespace content |
| OLD | NEW |