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