Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 906283003: PlzNavigate: Support data urls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + change to unit test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/navigator_impl_unittest.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 } 1489 }
1489 1490
1490 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { 1491 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) {
1491 TRACE_EVENT0("navigation", "RenderFrameHostImpl::Navigate"); 1492 TRACE_EVENT0("navigation", "RenderFrameHostImpl::Navigate");
1492 // Browser plugin guests are not allowed to navigate outside web-safe schemes, 1493 // Browser plugin guests are not allowed to navigate outside web-safe schemes,
1493 // so do not grant them the ability to request additional URLs. 1494 // so do not grant them the ability to request additional URLs.
1494 if (!GetProcess()->IsIsolatedGuest()) { 1495 if (!GetProcess()->IsIsolatedGuest()) {
1495 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( 1496 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL(
1496 GetProcess()->GetID(), params.common_params.url); 1497 GetProcess()->GetID(), params.common_params.url);
1497 if (params.common_params.url.SchemeIs(url::kDataScheme) && 1498 if (params.common_params.url.SchemeIs(url::kDataScheme) &&
1498 params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { 1499 params.common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) {
1499 // If 'data:' is used, and we have a 'file:' base url, grant access to 1500 // If 'data:' is used, and we have a 'file:' base url, grant access to
1500 // local files. 1501 // local files.
1501 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( 1502 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL(
1502 GetProcess()->GetID(), params.base_url_for_data_url); 1503 GetProcess()->GetID(), params.common_params.base_url_for_data_url);
1503 } 1504 }
1504 } 1505 }
1505 1506
1506 // 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
1507 // 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
1508 // 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
1509 // are received from the renderer to prevent abuse. 1510 // are received from the renderer to prevent abuse.
1510 if (params.commit_params.page_state.IsValid()) { 1511 if (params.commit_params.page_state.IsValid()) {
1511 render_view_host_->GrantFileAccessFromPageState( 1512 render_view_host_->GrantFileAccessFromPageState(
1512 params.commit_params.page_state); 1513 params.commit_params.page_state);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 if (is_waiting && dialog_was_suppressed) 1660 if (is_waiting && dialog_was_suppressed)
1660 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); 1661 render_view_host_->delegate_->RendererUnresponsive(render_view_host_);
1661 } 1662 }
1662 1663
1663 // PlzNavigate 1664 // PlzNavigate
1664 void RenderFrameHostImpl::CommitNavigation( 1665 void RenderFrameHostImpl::CommitNavigation(
1665 ResourceResponse* response, 1666 ResourceResponse* response,
1666 scoped_ptr<StreamHandle> body, 1667 scoped_ptr<StreamHandle> body,
1667 const CommonNavigationParams& common_params, 1668 const CommonNavigationParams& common_params,
1668 const CommitNavigationParams& commit_params) { 1669 const CommitNavigationParams& commit_params) {
1670 DCHECK((response && body.get()) ||
1671 !NavigationRequest::ShouldMakeNetworkRequest(common_params.url));
1669 // TODO(clamy): Check if we have to add security checks for the browser plugin 1672 // TODO(clamy): Check if we have to add security checks for the browser plugin
1670 // guests. 1673 // guests.
1671 1674
1672 // Get back to a clean state, in case we start a new navigation without 1675 // Get back to a clean state, in case we start a new navigation without
1673 // completing a RFH swap or unload handler. 1676 // completing a RFH swap or unload handler.
1674 SetState(RenderFrameHostImpl::STATE_DEFAULT); 1677 SetState(RenderFrameHostImpl::STATE_DEFAULT);
1675 1678
1679 const GURL body_url = body.get() ? body->GetURL() : GURL();
1680 const ResourceResponseHead head = response ?
1681 response->head : ResourceResponseHead();
1676 Send(new FrameMsg_CommitNavigation( 1682 Send(new FrameMsg_CommitNavigation(
1677 routing_id_, response->head, body->GetURL(), 1683 routing_id_, head, body_url, common_params, commit_params));
1678 common_params, commit_params));
1679 // TODO(clamy): Check if we should start the throbber for non javascript urls 1684 // TODO(clamy): Check if we should start the throbber for non javascript urls
1680 // here. 1685 // here.
1681 1686
1682 // TODO(clamy): Release the stream handle once the renderer has finished 1687 // TODO(clamy): Release the stream handle once the renderer has finished
1683 // reading it. 1688 // reading it.
1684 stream_handle_ = body.Pass(); 1689 stream_handle_ = body.Pass();
1685 } 1690 }
1686 1691
1687 void RenderFrameHostImpl::SetUpMojoIfNeeded() { 1692 void RenderFrameHostImpl::SetUpMojoIfNeeded() {
1688 if (service_registry_.get()) 1693 if (service_registry_.get())
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1915 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1911 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1916 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1912 GetContentClient()->browser()->RegisterPermissionUsage( 1917 GetContentClient()->browser()->RegisterPermissionUsage(
1913 PERMISSION_GEOLOCATION, 1918 PERMISSION_GEOLOCATION,
1914 delegate_->GetAsWebContents(), 1919 delegate_->GetAsWebContents(),
1915 GetLastCommittedURL().GetOrigin(), 1920 GetLastCommittedURL().GetOrigin(),
1916 top_frame->GetLastCommittedURL().GetOrigin()); 1921 top_frame->GetLastCommittedURL().GetOrigin());
1917 } 1922 }
1918 1923
1919 } // namespace content 1924 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl_unittest.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698