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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 } | 1817 } |
1818 | 1818 |
1819 void RenderFrameHostImpl::OnEnforceInsecureRequestPolicy( | 1819 void RenderFrameHostImpl::OnEnforceInsecureRequestPolicy( |
1820 blink::WebInsecureRequestPolicy policy) { | 1820 blink::WebInsecureRequestPolicy policy) { |
1821 frame_tree_node()->SetInsecureRequestPolicy(policy); | 1821 frame_tree_node()->SetInsecureRequestPolicy(policy); |
1822 } | 1822 } |
1823 | 1823 |
1824 void RenderFrameHostImpl::OnUpdateToUniqueOrigin( | 1824 void RenderFrameHostImpl::OnUpdateToUniqueOrigin( |
1825 bool is_potentially_trustworthy_unique_origin) { | 1825 bool is_potentially_trustworthy_unique_origin) { |
1826 url::Origin origin; | 1826 url::Origin origin; |
1827 DCHECK(origin.unique()); | 1827 DCHECK(origin.opaque()); |
1828 frame_tree_node()->SetCurrentOrigin(origin, | 1828 frame_tree_node()->SetCurrentOrigin(origin, |
1829 is_potentially_trustworthy_unique_origin); | 1829 is_potentially_trustworthy_unique_origin); |
1830 } | 1830 } |
1831 | 1831 |
1832 FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChild( | 1832 FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChild( |
1833 int32_t child_frame_routing_id, | 1833 int32_t child_frame_routing_id, |
1834 bad_message::BadMessageReason reason) { | 1834 bad_message::BadMessageReason reason) { |
1835 FrameTreeNode* child = frame_tree_node()->frame_tree()->FindByRoutingID( | 1835 FrameTreeNode* child = frame_tree_node()->frame_tree()->FindByRoutingID( |
1836 GetProcess()->GetID(), child_frame_routing_id); | 1836 GetProcess()->GetID(), child_frame_routing_id); |
1837 // A race can result in |child| to be nullptr. Avoid killing the renderer in | 1837 // A race can result in |child| to be nullptr. Avoid killing the renderer in |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 return true; | 2422 return true; |
2423 } | 2423 } |
2424 | 2424 |
2425 // file: URLs can be allowed to access any other origin, based on settings. | 2425 // file: URLs can be allowed to access any other origin, based on settings. |
2426 if (origin.scheme() == url::kFileScheme) { | 2426 if (origin.scheme() == url::kFileScheme) { |
2427 WebPreferences prefs = render_view_host_->GetWebkitPreferences(); | 2427 WebPreferences prefs = render_view_host_->GetWebkitPreferences(); |
2428 if (prefs.allow_universal_access_from_file_urls) | 2428 if (prefs.allow_universal_access_from_file_urls) |
2429 return true; | 2429 return true; |
2430 } | 2430 } |
2431 | 2431 |
2432 // It is safe to commit into a unique origin, regardless of the URL, as it is | 2432 // It is safe to commit into a opaque origin, regardless of the URL, as it is |
2433 // restricted from accessing other origins. | 2433 // restricted from accessing other origins. |
2434 if (origin.unique()) | 2434 if (origin.opaque()) |
2435 return true; | 2435 return true; |
2436 | 2436 |
2437 // Standard URLs must match the reported origin. | 2437 // Standard URLs must match the reported origin. |
2438 if (url.IsStandard() && !origin.IsSameOriginWith(url::Origin(url))) | 2438 if (url.IsStandard() && !origin.IsSameOriginWith(url::Origin(url))) |
2439 return false; | 2439 return false; |
2440 | 2440 |
2441 // A non-unique origin must be a valid URL, which allows us to safely do a | 2441 // A non-opaque origin must be a valid URL, which allows us to safely do a |
2442 // conversion to GURL. | 2442 // conversion to GURL. |
2443 GURL origin_url(origin.Serialize()); | 2443 GURL origin_url(origin.Serialize()); |
2444 | 2444 |
2445 // Verify that the origin is allowed to commit in this process. | 2445 // Verify that the origin is allowed to commit in this process. |
2446 // Note: This also handles non-standard cases for |url|, such as | 2446 // Note: This also handles non-standard cases for |url|, such as |
2447 // about:blank, data, and blob URLs. | 2447 // about:blank, data, and blob URLs. |
2448 return CanCommitURL(origin_url); | 2448 return CanCommitURL(origin_url); |
2449 } | 2449 } |
2450 | 2450 |
2451 void RenderFrameHostImpl::Navigate( | 2451 void RenderFrameHostImpl::Navigate( |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3447 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3447 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3448 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3448 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3450 return NavigationHandleImpl::Create( | 3450 return NavigationHandleImpl::Create( |
3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
3452 params.was_within_same_page, base::TimeTicks::Now(), | 3452 params.was_within_same_page, base::TimeTicks::Now(), |
3453 entry_id_for_data_nav, false); // started_from_context_menu | 3453 entry_id_for_data_nav, false); // started_from_context_menu |
3454 } | 3454 } |
3455 | 3455 |
3456 } // namespace content | 3456 } // namespace content |
OLD | NEW |