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 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 } | 1464 } |
1465 | 1465 |
1466 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { | 1466 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { |
1467 TRACE_EVENT0("navigation", "RenderFrameHostImpl::Navigate"); | 1467 TRACE_EVENT0("navigation", "RenderFrameHostImpl::Navigate"); |
1468 // Browser plugin guests are not allowed to navigate outside web-safe schemes, | 1468 // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
1469 // so do not grant them the ability to request additional URLs. | 1469 // so do not grant them the ability to request additional URLs. |
1470 if (!GetProcess()->IsIsolatedGuest()) { | 1470 if (!GetProcess()->IsIsolatedGuest()) { |
1471 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 1471 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
1472 GetProcess()->GetID(), params.common_params.url); | 1472 GetProcess()->GetID(), params.common_params.url); |
1473 if (params.common_params.url.SchemeIs(url::kDataScheme) && | 1473 if (params.common_params.url.SchemeIs(url::kDataScheme) && |
1474 params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { | 1474 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 | 1475 // If 'data:' is used, and we have a 'file:' base url, grant access to |
1476 // local files. | 1476 // local files. |
1477 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 1477 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
1478 GetProcess()->GetID(), params.base_url_for_data_url); | 1478 GetProcess()->GetID(), params.common_params.base_url_for_data_url); |
1479 } | 1479 } |
1480 } | 1480 } |
1481 | 1481 |
1482 // We may be returning to an existing NavigationEntry that had been granted | 1482 // 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 | 1483 // 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 | 1484 // access again. The files listed in the page state are validated when they |
1485 // are received from the renderer to prevent abuse. | 1485 // are received from the renderer to prevent abuse. |
1486 if (params.commit_params.page_state.IsValid()) { | 1486 if (params.commit_params.page_state.IsValid()) { |
1487 render_view_host_->GrantFileAccessFromPageState( | 1487 render_view_host_->GrantFileAccessFromPageState( |
1488 params.commit_params.page_state); | 1488 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) | 1635 if (is_waiting && dialog_was_suppressed) |
1636 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); | 1636 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); |
1637 } | 1637 } |
1638 | 1638 |
1639 // PlzNavigate | 1639 // PlzNavigate |
1640 void RenderFrameHostImpl::CommitNavigation( | 1640 void RenderFrameHostImpl::CommitNavigation( |
1641 ResourceResponse* response, | 1641 ResourceResponse* response, |
1642 scoped_ptr<StreamHandle> body, | 1642 scoped_ptr<StreamHandle> body, |
1643 const CommonNavigationParams& common_params, | 1643 const CommonNavigationParams& common_params, |
1644 const CommitNavigationParams& commit_params) { | 1644 const CommitNavigationParams& commit_params) { |
| 1645 DCHECK((response && body.get()) || |
| 1646 !ShouldMakeNetworkRequestForNavigation(common_params.url)); |
1645 // TODO(clamy): Check if we have to add security checks for the browser plugin | 1647 // TODO(clamy): Check if we have to add security checks for the browser plugin |
1646 // guests. | 1648 // guests. |
1647 | 1649 |
1648 // Get back to a clean state, in case we start a new navigation without | 1650 // Get back to a clean state, in case we start a new navigation without |
1649 // completing a RFH swap or unload handler. | 1651 // completing a RFH swap or unload handler. |
1650 SetState(RenderFrameHostImpl::STATE_DEFAULT); | 1652 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
1651 | 1653 |
| 1654 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
| 1655 const ResourceResponseHead head = response ? |
| 1656 response->head : ResourceResponseHead(); |
1652 Send(new FrameMsg_CommitNavigation( | 1657 Send(new FrameMsg_CommitNavigation( |
1653 routing_id_, response->head, body->GetURL(), | 1658 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 | 1659 // TODO(clamy): Check if we should start the throbber for non javascript urls |
1656 // here. | 1660 // here. |
1657 | 1661 |
1658 // TODO(clamy): Release the stream handle once the renderer has finished | 1662 // TODO(clamy): Release the stream handle once the renderer has finished |
1659 // reading it. | 1663 // reading it. |
1660 stream_handle_ = body.Pass(); | 1664 stream_handle_ = body.Pass(); |
1661 } | 1665 } |
1662 | 1666 |
1663 void RenderFrameHostImpl::SetUpMojoIfNeeded() { | 1667 void RenderFrameHostImpl::SetUpMojoIfNeeded() { |
1664 if (service_registry_.get()) | 1668 if (service_registry_.get()) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1890 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1887 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1891 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1888 GetContentClient()->browser()->RegisterPermissionUsage( | 1892 GetContentClient()->browser()->RegisterPermissionUsage( |
1889 PERMISSION_GEOLOCATION, | 1893 PERMISSION_GEOLOCATION, |
1890 delegate_->GetAsWebContents(), | 1894 delegate_->GetAsWebContents(), |
1891 GetLastCommittedURL().GetOrigin(), | 1895 GetLastCommittedURL().GetOrigin(), |
1892 top_frame->GetLastCommittedURL().GetOrigin()); | 1896 top_frame->GetLastCommittedURL().GetOrigin()); |
1893 } | 1897 } |
1894 | 1898 |
1895 } // namespace content | 1899 } // namespace content |
OLD | NEW |