OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2857 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
2858 suggested_name)); | 2858 suggested_name)); |
2859 } else { | 2859 } else { |
2860 OpenURL(frame, request.url(), referrer, policy); | 2860 OpenURL(frame, request.url(), referrer, policy); |
2861 } | 2861 } |
2862 } | 2862 } |
2863 | 2863 |
2864 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 2864 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
2865 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 2865 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
2866 WebNavigationPolicy default_policy, bool is_redirect) { | 2866 WebNavigationPolicy default_policy, bool is_redirect) { |
2867 if (request.url() != GURL(kSwappedOutURL) && | 2867 // Webkit is asking whether to navigate to a new URL. |
| 2868 // This is fine normally, except if we're showing UI from one security |
| 2869 // context and they're trying to navigate to a different context. |
| 2870 |
| 2871 const GURL& url = request.url(); |
| 2872 |
| 2873 if (url != GURL(kSwappedOutURL) && |
2868 GetContentClient()->renderer()->HandleNavigation(frame, request, type, | 2874 GetContentClient()->renderer()->HandleNavigation(frame, request, type, |
2869 default_policy, | 2875 default_policy, |
2870 is_redirect)) { | 2876 is_redirect)) { |
2871 return WebKit::WebNavigationPolicyIgnore; | 2877 return WebKit::WebNavigationPolicyIgnore; |
2872 } | 2878 } |
2873 | 2879 |
2874 Referrer referrer( | 2880 Referrer referrer( |
2875 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2881 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2876 GetReferrerPolicyFromRequest(frame, request)); | 2882 GetReferrerPolicyFromRequest(frame, request)); |
2877 | 2883 |
2878 if (is_swapped_out_) { | 2884 if (is_swapped_out_) { |
2879 if (request.url() != GURL(kSwappedOutURL)) { | 2885 if (url != GURL(kSwappedOutURL)) { |
2880 // Targeted links may try to navigate a swapped out frame. Allow the | 2886 // Targeted links may try to navigate a swapped out frame. Allow the |
2881 // browser process to navigate the tab instead. Note that it is also | 2887 // browser process to navigate the tab instead. Note that it is also |
2882 // possible for non-targeted navigations (from this view) to arrive | 2888 // possible for non-targeted navigations (from this view) to arrive |
2883 // here just after we are swapped out. It's ok to send them to the | 2889 // here just after we are swapped out. It's ok to send them to the |
2884 // browser, as long as they're for the top level frame. | 2890 // browser, as long as they're for the top level frame. |
2885 // TODO(creis): Ensure this supports targeted form submissions when | 2891 // TODO(creis): Ensure this supports targeted form submissions when |
2886 // fixing http://crbug.com/101395. | 2892 // fixing http://crbug.com/101395. |
2887 if (frame->parent() == NULL) { | 2893 if (frame->parent() == NULL) { |
2888 OpenURL(frame, request.url(), referrer, default_policy); | 2894 OpenURL(frame, url, referrer, default_policy); |
2889 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2895 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2890 } | 2896 } |
2891 | 2897 |
2892 // We should otherwise ignore in-process iframe navigations, if they | 2898 // We should otherwise ignore in-process iframe navigations, if they |
2893 // arrive just after we are swapped out. | 2899 // arrive just after we are swapped out. |
2894 return WebKit::WebNavigationPolicyIgnore; | 2900 return WebKit::WebNavigationPolicyIgnore; |
2895 } | 2901 } |
2896 | 2902 |
2897 // Allow kSwappedOutURL to complete. | 2903 // Allow kSwappedOutURL to complete. |
2898 return default_policy; | 2904 return default_policy; |
2899 } | 2905 } |
2900 | 2906 |
2901 // Webkit is asking whether to navigate to a new URL. | |
2902 // This is fine normally, except if we're showing UI from one security | |
2903 // context and they're trying to navigate to a different context. | |
2904 const GURL& url = request.url(); | |
2905 | |
2906 // A content initiated navigation may have originated from a link-click, | 2907 // A content initiated navigation may have originated from a link-click, |
2907 // script, drag-n-drop operation, etc. | 2908 // script, drag-n-drop operation, etc. |
2908 bool is_content_initiated = | 2909 bool is_content_initiated = |
2909 DocumentState::FromDataSource(frame->provisionalDataSource())-> | 2910 DocumentState::FromDataSource(frame->provisionalDataSource())-> |
2910 navigation_state()->is_content_initiated(); | 2911 navigation_state()->is_content_initiated(); |
2911 | 2912 |
2912 // Experimental: | 2913 // Experimental: |
2913 // If --enable-strict-site-isolation or --site-per-process is enabled, send | 2914 // If --enable-strict-site-isolation or --site-per-process is enabled, send |
2914 // all top-level navigations to the browser to let it swap processes when | 2915 // all top-level navigations to the browser to let it swap processes when |
2915 // crossing site boundaries. This is currently expected to break some script | 2916 // crossing site boundaries. This is currently expected to break some script |
(...skipping 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6622 WebURL url = icon_urls[i].iconURL(); | 6623 WebURL url = icon_urls[i].iconURL(); |
6623 if (!url.isEmpty()) | 6624 if (!url.isEmpty()) |
6624 urls.push_back(FaviconURL(url, | 6625 urls.push_back(FaviconURL(url, |
6625 ToFaviconType(icon_urls[i].iconType()))); | 6626 ToFaviconType(icon_urls[i].iconType()))); |
6626 } | 6627 } |
6627 SendUpdateFaviconURL(urls); | 6628 SendUpdateFaviconURL(urls); |
6628 } | 6629 } |
6629 | 6630 |
6630 | 6631 |
6631 } // namespace content | 6632 } // namespace content |
OLD | NEW |