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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 // local files. | 1501 // local files. |
1502 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 1502 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
1503 GetProcess()->GetID(), params.common_params.base_url_for_data_url); | 1503 GetProcess()->GetID(), params.common_params.base_url_for_data_url); |
1504 } | 1504 } |
1505 } | 1505 } |
1506 | 1506 |
1507 // We may be returning to an existing NavigationEntry that had been granted | 1507 // We may be returning to an existing NavigationEntry that had been granted |
1508 // file access. If this is a different process, we will need to grant the | 1508 // file access. If this is a different process, we will need to grant the |
1509 // access again. The files listed in the page state are validated when they | 1509 // access again. The files listed in the page state are validated when they |
1510 // are received from the renderer to prevent abuse. | 1510 // are received from the renderer to prevent abuse. |
1511 if (params.commit_params.page_state.IsValid()) { | 1511 if (params.history_params.page_state.IsValid()) { |
1512 render_view_host_->GrantFileAccessFromPageState( | 1512 render_view_host_->GrantFileAccessFromPageState( |
1513 params.commit_params.page_state); | 1513 params.history_params.page_state); |
1514 } | 1514 } |
1515 | 1515 |
1516 // Only send the message if we aren't suspended at the start of a cross-site | 1516 // Only send the message if we aren't suspended at the start of a cross-site |
1517 // request. | 1517 // request. |
1518 if (navigations_suspended_) { | 1518 if (navigations_suspended_) { |
1519 // Shouldn't be possible to have a second navigation while suspended, since | 1519 // Shouldn't be possible to have a second navigation while suspended, since |
1520 // navigations will only be suspended during a cross-site request. If a | 1520 // navigations will only be suspended during a cross-site request. If a |
1521 // second navigation occurs, RenderFrameHostManager will cancel this pending | 1521 // second navigation occurs, RenderFrameHostManager will cancel this pending |
1522 // RFH and create a new pending RFH. | 1522 // RFH and create a new pending RFH. |
1523 DCHECK(!suspended_nav_params_.get()); | 1523 DCHECK(!suspended_nav_params_.get()); |
(...skipping 20 matching lines...) Expand all Loading... |
1544 if (!params.common_params.url.SchemeIs(url::kJavaScriptScheme)) | 1544 if (!params.common_params.url.SchemeIs(url::kJavaScriptScheme)) |
1545 delegate_->DidStartLoading(this, true); | 1545 delegate_->DidStartLoading(this, true); |
1546 } | 1546 } |
1547 | 1547 |
1548 void RenderFrameHostImpl::NavigateToURL(const GURL& url) { | 1548 void RenderFrameHostImpl::NavigateToURL(const GURL& url) { |
1549 FrameMsg_Navigate_Params params; | 1549 FrameMsg_Navigate_Params params; |
1550 params.common_params.url = url; | 1550 params.common_params.url = url; |
1551 params.common_params.transition = ui::PAGE_TRANSITION_LINK; | 1551 params.common_params.transition = ui::PAGE_TRANSITION_LINK; |
1552 params.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1552 params.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1553 params.commit_params.browser_navigation_start = base::TimeTicks::Now(); | 1553 params.commit_params.browser_navigation_start = base::TimeTicks::Now(); |
1554 params.page_id = -1; | 1554 params.history_params.page_id = -1; |
1555 params.pending_history_list_offset = -1; | 1555 params.history_params.pending_history_list_offset = -1; |
1556 params.current_history_list_offset = -1; | 1556 params.history_params.current_history_list_offset = -1; |
1557 params.current_history_list_length = 0; | 1557 params.history_params.current_history_list_length = 0; |
1558 Navigate(params); | 1558 Navigate(params); |
1559 } | 1559 } |
1560 | 1560 |
1561 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 1561 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
1562 SiteInstance* source_site_instance) { | 1562 SiteInstance* source_site_instance) { |
1563 GURL validated_url(params.url); | 1563 GURL validated_url(params.url); |
1564 GetProcess()->FilterURL(false, &validated_url); | 1564 GetProcess()->FilterURL(false, &validated_url); |
1565 | 1565 |
1566 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", | 1566 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", |
1567 validated_url.possibly_invalid_spec()); | 1567 validated_url.possibly_invalid_spec()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 // correctly while waiting for a response. | 1659 // correctly while waiting for a response. |
1660 if (is_waiting && dialog_was_suppressed) | 1660 if (is_waiting && dialog_was_suppressed) |
1661 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); | 1661 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); |
1662 } | 1662 } |
1663 | 1663 |
1664 // PlzNavigate | 1664 // PlzNavigate |
1665 void RenderFrameHostImpl::CommitNavigation( | 1665 void RenderFrameHostImpl::CommitNavigation( |
1666 ResourceResponse* response, | 1666 ResourceResponse* response, |
1667 scoped_ptr<StreamHandle> body, | 1667 scoped_ptr<StreamHandle> body, |
1668 const CommonNavigationParams& common_params, | 1668 const CommonNavigationParams& common_params, |
1669 const CommitNavigationParams& commit_params) { | 1669 const CommitNavigationParams& commit_params, |
| 1670 const HistoryNavigationParams& history_params) { |
1670 DCHECK((response && body.get()) || | 1671 DCHECK((response && body.get()) || |
1671 !NavigationRequest::ShouldMakeNetworkRequest(common_params.url)); | 1672 !NavigationRequest::ShouldMakeNetworkRequest(common_params.url)); |
1672 // TODO(clamy): Check if we have to add security checks for the browser plugin | 1673 // TODO(clamy): Check if we have to add security checks for the browser plugin |
1673 // guests. | 1674 // guests. |
1674 | 1675 |
1675 // Get back to a clean state, in case we start a new navigation without | 1676 // Get back to a clean state, in case we start a new navigation without |
1676 // completing a RFH swap or unload handler. | 1677 // completing a RFH swap or unload handler. |
1677 SetState(RenderFrameHostImpl::STATE_DEFAULT); | 1678 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
1678 | 1679 |
1679 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 1680 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
1680 const ResourceResponseHead head = response ? | 1681 const ResourceResponseHead head = response ? |
1681 response->head : ResourceResponseHead(); | 1682 response->head : ResourceResponseHead(); |
1682 Send(new FrameMsg_CommitNavigation( | 1683 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
1683 routing_id_, head, body_url, common_params, commit_params)); | 1684 commit_params, history_params)); |
1684 // TODO(clamy): Check if we should start the throbber for non javascript urls | 1685 // TODO(clamy): Check if we should start the throbber for non javascript urls |
1685 // here. | 1686 // here. |
1686 | 1687 |
1687 // TODO(clamy): Release the stream handle once the renderer has finished | 1688 // TODO(clamy): Release the stream handle once the renderer has finished |
1688 // reading it. | 1689 // reading it. |
1689 stream_handle_ = body.Pass(); | 1690 stream_handle_ = body.Pass(); |
1690 } | 1691 } |
1691 | 1692 |
1692 void RenderFrameHostImpl::SetUpMojoIfNeeded() { | 1693 void RenderFrameHostImpl::SetUpMojoIfNeeded() { |
1693 if (service_registry_.get()) | 1694 if (service_registry_.get()) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1916 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1916 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1917 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1917 GetContentClient()->browser()->RegisterPermissionUsage( | 1918 GetContentClient()->browser()->RegisterPermissionUsage( |
1918 PERMISSION_GEOLOCATION, | 1919 PERMISSION_GEOLOCATION, |
1919 delegate_->GetAsWebContents(), | 1920 delegate_->GetAsWebContents(), |
1920 GetLastCommittedURL().GetOrigin(), | 1921 GetLastCommittedURL().GetOrigin(), |
1921 top_frame->GetLastCommittedURL().GetOrigin()); | 1922 top_frame->GetLastCommittedURL().GetOrigin()); |
1922 } | 1923 } |
1923 | 1924 |
1924 } // namespace content | 1925 } // namespace content |
OLD | NEW |