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. |
Charlie Reis
2013/08/26 22:17:52
Is there a functional change here, or is this main
sergeygs
2013/08/29 08:24:42
Correct, this is mainly reformatting. I'll revert
| |
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 // Give registered ContentClient a chance to intercept the URL. | |
2874 if (url != GURL(kSwappedOutURL) && | |
2868 GetContentClient()->renderer()->HandleNavigation(frame, request, type, | 2875 GetContentClient()->renderer()->HandleNavigation(frame, request, type, |
2869 default_policy, | 2876 default_policy, |
2870 is_redirect)) { | 2877 is_redirect)) { |
2871 return WebKit::WebNavigationPolicyIgnore; | 2878 return WebKit::WebNavigationPolicyIgnore; |
2872 } | 2879 } |
2873 | 2880 |
2874 Referrer referrer( | 2881 Referrer referrer( |
2875 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2882 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2876 GetReferrerPolicyFromRequest(frame, request)); | 2883 GetReferrerPolicyFromRequest(frame, request)); |
2877 | 2884 |
2878 if (is_swapped_out_) { | 2885 if (is_swapped_out_) { |
2879 if (request.url() != GURL(kSwappedOutURL)) { | 2886 if (url != GURL(kSwappedOutURL)) { |
2880 // Targeted links may try to navigate a swapped out frame. Allow the | 2887 // 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 | 2888 // browser process to navigate the tab instead. Note that it is also |
2882 // possible for non-targeted navigations (from this view) to arrive | 2889 // 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 | 2890 // 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. | 2891 // browser, as long as they're for the top level frame. |
2885 // TODO(creis): Ensure this supports targeted form submissions when | 2892 // TODO(creis): Ensure this supports targeted form submissions when |
2886 // fixing http://crbug.com/101395. | 2893 // fixing http://crbug.com/101395. |
2887 if (frame->parent() == NULL) { | 2894 if (frame->parent() == NULL) { |
2888 OpenURL(frame, request.url(), referrer, default_policy); | 2895 OpenURL(frame, url, referrer, default_policy); |
2889 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2896 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2890 } | 2897 } |
2891 | 2898 |
2892 // We should otherwise ignore in-process iframe navigations, if they | 2899 // We should otherwise ignore in-process iframe navigations, if they |
2893 // arrive just after we are swapped out. | 2900 // arrive just after we are swapped out. |
2894 return WebKit::WebNavigationPolicyIgnore; | 2901 return WebKit::WebNavigationPolicyIgnore; |
2895 } | 2902 } |
2896 | 2903 |
2897 // Allow kSwappedOutURL to complete. | 2904 // Allow kSwappedOutURL to complete. |
2898 return default_policy; | 2905 return default_policy; |
2899 } | 2906 } |
2900 | 2907 |
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, | 2908 // A content initiated navigation may have originated from a link-click, |
2907 // script, drag-n-drop operation, etc. | 2909 // script, drag-n-drop operation, etc. |
2908 bool is_content_initiated = | 2910 bool is_content_initiated = |
2909 DocumentState::FromDataSource(frame->provisionalDataSource())-> | 2911 DocumentState::FromDataSource(frame->provisionalDataSource())-> |
2910 navigation_state()->is_content_initiated(); | 2912 navigation_state()->is_content_initiated(); |
2911 | 2913 |
2912 // Experimental: | 2914 // Experimental: |
2913 // If --enable-strict-site-isolation or --site-per-process is enabled, send | 2915 // 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 | 2916 // 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 | 2917 // 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(); | 6624 WebURL url = icon_urls[i].iconURL(); |
6623 if (!url.isEmpty()) | 6625 if (!url.isEmpty()) |
6624 urls.push_back(FaviconURL(url, | 6626 urls.push_back(FaviconURL(url, |
6625 ToFaviconType(icon_urls[i].iconType()))); | 6627 ToFaviconType(icon_urls[i].iconType()))); |
6626 } | 6628 } |
6627 SendUpdateFaviconURL(urls); | 6629 SendUpdateFaviconURL(urls); |
6628 } | 6630 } |
6629 | 6631 |
6630 | 6632 |
6631 } // namespace content | 6633 } // namespace content |
OLD | NEW |