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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/metrics/user_metrics_action.h" | 12 #include "base/metrics/user_metrics_action.h" |
13 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/browser/accessibility/accessibility_mode_helper.h" | 15 #include "content/browser/accessibility/accessibility_mode_helper.h" |
16 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager.h" |
17 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 17 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
18 #include "content/browser/child_process_security_policy_impl.h" | 18 #include "content/browser/child_process_security_policy_impl.h" |
19 #include "content/browser/frame_host/cross_process_frame_connector.h" | 19 #include "content/browser/frame_host/cross_process_frame_connector.h" |
20 #include "content/browser/frame_host/cross_site_transferring_request.h" | 20 #include "content/browser/frame_host/cross_site_transferring_request.h" |
21 #include "content/browser/frame_host/frame_accessibility.h" | 21 #include "content/browser/frame_host/frame_accessibility.h" |
22 #include "content/browser/frame_host/frame_tree.h" | 22 #include "content/browser/frame_host/frame_tree.h" |
23 #include "content/browser/frame_host/frame_tree_node.h" | 23 #include "content/browser/frame_host/frame_tree_node.h" |
| 24 #include "content/browser/frame_host/navigation_request.h" |
24 #include "content/browser/frame_host/navigator.h" | 25 #include "content/browser/frame_host/navigator.h" |
25 #include "content/browser/frame_host/navigator_impl.h" | 26 #include "content/browser/frame_host/navigator_impl.h" |
26 #include "content/browser/frame_host/render_frame_host_delegate.h" | 27 #include "content/browser/frame_host/render_frame_host_delegate.h" |
27 #include "content/browser/frame_host/render_frame_proxy_host.h" | 28 #include "content/browser/frame_host/render_frame_proxy_host.h" |
28 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 29 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
29 #include "content/browser/geolocation/geolocation_service_context.h" | 30 #include "content/browser/geolocation/geolocation_service_context.h" |
30 #include "content/browser/permissions/permission_service_context.h" | 31 #include "content/browser/permissions/permission_service_context.h" |
31 #include "content/browser/permissions/permission_service_impl.h" | 32 #include "content/browser/permissions/permission_service_impl.h" |
32 #include "content/browser/presentation/presentation_service_impl.h" | 33 #include "content/browser/presentation/presentation_service_impl.h" |
33 #include "content/browser/renderer_host/input/input_router.h" | 34 #include "content/browser/renderer_host/input/input_router.h" |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 } | 1465 } |
1465 | 1466 |
1466 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { | 1467 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { |
1467 TRACE_EVENT0("navigation", "RenderFrameHostImpl::Navigate"); | 1468 TRACE_EVENT0("navigation", "RenderFrameHostImpl::Navigate"); |
1468 // Browser plugin guests are not allowed to navigate outside web-safe schemes, | 1469 // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
1469 // so do not grant them the ability to request additional URLs. | 1470 // so do not grant them the ability to request additional URLs. |
1470 if (!GetProcess()->IsIsolatedGuest()) { | 1471 if (!GetProcess()->IsIsolatedGuest()) { |
1471 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 1472 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
1472 GetProcess()->GetID(), params.common_params.url); | 1473 GetProcess()->GetID(), params.common_params.url); |
1473 if (params.common_params.url.SchemeIs(url::kDataScheme) && | 1474 if (params.common_params.url.SchemeIs(url::kDataScheme) && |
1474 params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { | 1475 params.common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { |
1475 // If 'data:' is used, and we have a 'file:' base url, grant access to | 1476 // If 'data:' is used, and we have a 'file:' base url, grant access to |
1476 // local files. | 1477 // local files. |
1477 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 1478 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
1478 GetProcess()->GetID(), params.base_url_for_data_url); | 1479 GetProcess()->GetID(), params.common_params.base_url_for_data_url); |
1479 } | 1480 } |
1480 } | 1481 } |
1481 | 1482 |
1482 // We may be returning to an existing NavigationEntry that had been granted | 1483 // We may be returning to an existing NavigationEntry that had been granted |
1483 // file access. If this is a different process, we will need to grant the | 1484 // file access. If this is a different process, we will need to grant the |
1484 // access again. The files listed in the page state are validated when they | 1485 // access again. The files listed in the page state are validated when they |
1485 // are received from the renderer to prevent abuse. | 1486 // are received from the renderer to prevent abuse. |
1486 if (params.commit_params.page_state.IsValid()) { | 1487 if (params.commit_params.page_state.IsValid()) { |
1487 render_view_host_->GrantFileAccessFromPageState( | 1488 render_view_host_->GrantFileAccessFromPageState( |
1488 params.commit_params.page_state); | 1489 params.commit_params.page_state); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 if (is_waiting && dialog_was_suppressed) | 1636 if (is_waiting && dialog_was_suppressed) |
1636 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); | 1637 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); |
1637 } | 1638 } |
1638 | 1639 |
1639 // PlzNavigate | 1640 // PlzNavigate |
1640 void RenderFrameHostImpl::CommitNavigation( | 1641 void RenderFrameHostImpl::CommitNavigation( |
1641 ResourceResponse* response, | 1642 ResourceResponse* response, |
1642 scoped_ptr<StreamHandle> body, | 1643 scoped_ptr<StreamHandle> body, |
1643 const CommonNavigationParams& common_params, | 1644 const CommonNavigationParams& common_params, |
1644 const CommitNavigationParams& commit_params) { | 1645 const CommitNavigationParams& commit_params) { |
| 1646 DCHECK((response && body.get()) || |
| 1647 !NavigationRequest::ShouldMakeNetworkRequest(common_params.url)); |
1645 // TODO(clamy): Check if we have to add security checks for the browser plugin | 1648 // TODO(clamy): Check if we have to add security checks for the browser plugin |
1646 // guests. | 1649 // guests. |
1647 | 1650 |
1648 // Get back to a clean state, in case we start a new navigation without | 1651 // Get back to a clean state, in case we start a new navigation without |
1649 // completing a RFH swap or unload handler. | 1652 // completing a RFH swap or unload handler. |
1650 SetState(RenderFrameHostImpl::STATE_DEFAULT); | 1653 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
1651 | 1654 |
| 1655 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
| 1656 const ResourceResponseHead head = response ? |
| 1657 response->head : ResourceResponseHead(); |
1652 Send(new FrameMsg_CommitNavigation( | 1658 Send(new FrameMsg_CommitNavigation( |
1653 routing_id_, response->head, body->GetURL(), | 1659 routing_id_, head, body_url, common_params, commit_params)); |
1654 common_params, commit_params)); | |
1655 // TODO(clamy): Check if we should start the throbber for non javascript urls | 1660 // TODO(clamy): Check if we should start the throbber for non javascript urls |
1656 // here. | 1661 // here. |
1657 | 1662 |
1658 // TODO(clamy): Release the stream handle once the renderer has finished | 1663 // TODO(clamy): Release the stream handle once the renderer has finished |
1659 // reading it. | 1664 // reading it. |
1660 stream_handle_ = body.Pass(); | 1665 stream_handle_ = body.Pass(); |
1661 } | 1666 } |
1662 | 1667 |
1663 void RenderFrameHostImpl::SetUpMojoIfNeeded() { | 1668 void RenderFrameHostImpl::SetUpMojoIfNeeded() { |
1664 if (service_registry_.get()) | 1669 if (service_registry_.get()) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1891 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1887 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1892 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1888 GetContentClient()->browser()->RegisterPermissionUsage( | 1893 GetContentClient()->browser()->RegisterPermissionUsage( |
1889 PERMISSION_GEOLOCATION, | 1894 PERMISSION_GEOLOCATION, |
1890 delegate_->GetAsWebContents(), | 1895 delegate_->GetAsWebContents(), |
1891 GetLastCommittedURL().GetOrigin(), | 1896 GetLastCommittedURL().GetOrigin(), |
1892 top_frame->GetLastCommittedURL().GetOrigin()); | 1897 top_frame->GetLastCommittedURL().GetOrigin()); |
1893 } | 1898 } |
1894 | 1899 |
1895 } // namespace content | 1900 } // namespace content |
OLD | NEW |