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 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2835 GetReferrerPolicyFromRequest(frame, request)); | 2835 GetReferrerPolicyFromRequest(frame, request)); |
2836 if (policy == WebKit::WebNavigationPolicyDownload) { | 2836 if (policy == WebKit::WebNavigationPolicyDownload) { |
2837 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2837 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
2838 suggested_name)); | 2838 suggested_name)); |
2839 } else { | 2839 } else { |
2840 OpenURL(frame, request.url(), referrer, policy); | 2840 OpenURL(frame, request.url(), referrer, policy); |
2841 } | 2841 } |
2842 } | 2842 } |
2843 | 2843 |
2844 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 2844 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
2845 WebFrame* frame, WebDataSource* dataSource, const WebURLRequest& request, | 2845 WebFrame* frame, WebDataSource::ExtraData* extraData, |
2846 WebNavigationType type, WebNavigationPolicy default_policy, | 2846 const WebURLRequest& request, WebNavigationType type, |
2847 bool is_redirect) { | 2847 WebNavigationPolicy default_policy, bool is_redirect) { |
2848 if (request.url() != GURL(kSwappedOutURL) && | 2848 if (request.url() != GURL(kSwappedOutURL) && |
2849 GetContentClient()->renderer()->HandleNavigation(frame, request, type, | 2849 GetContentClient()->renderer()->HandleNavigation(frame, request, type, |
2850 default_policy, | 2850 default_policy, |
2851 is_redirect)) { | 2851 is_redirect)) { |
2852 return WebKit::WebNavigationPolicyIgnore; | 2852 return WebKit::WebNavigationPolicyIgnore; |
2853 } | 2853 } |
2854 | 2854 |
2855 Referrer referrer( | 2855 Referrer referrer( |
2856 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2856 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2857 GetReferrerPolicyFromRequest(frame, request)); | 2857 GetReferrerPolicyFromRequest(frame, request)); |
(...skipping 21 matching lines...) Expand all Loading... | |
2879 return default_policy; | 2879 return default_policy; |
2880 } | 2880 } |
2881 | 2881 |
2882 // Webkit is asking whether to navigate to a new URL. | 2882 // Webkit is asking whether to navigate to a new URL. |
2883 // This is fine normally, except if we're showing UI from one security | 2883 // This is fine normally, except if we're showing UI from one security |
2884 // context and they're trying to navigate to a different context. | 2884 // context and they're trying to navigate to a different context. |
2885 const GURL& url = request.url(); | 2885 const GURL& url = request.url(); |
2886 | 2886 |
2887 // A content initiated navigation may have originated from a link-click, | 2887 // A content initiated navigation may have originated from a link-click, |
2888 // script, drag-n-drop operation, etc. | 2888 // script, drag-n-drop operation, etc. |
2889 bool is_content_initiated = | 2889 bool is_content_initiated = static_cast<DocumentState*>(extraData)-> |
2890 DocumentState::FromDataSource(dataSource)-> | |
abarth-chromium
2013/04/24 22:55:56
Should we add a FromExtraData method ?
| |
2891 navigation_state()->is_content_initiated(); | 2890 navigation_state()->is_content_initiated(); |
2892 | 2891 |
2893 // Experimental: | 2892 // Experimental: |
2894 // If --enable-strict-site-isolation or --site-per-process is enabled, send | 2893 // If --enable-strict-site-isolation or --site-per-process is enabled, send |
2895 // all top-level navigations to the browser to let it swap processes when | 2894 // all top-level navigations to the browser to let it swap processes when |
2896 // crossing site boundaries. This is currently expected to break some script | 2895 // crossing site boundaries. This is currently expected to break some script |
2897 // calls and navigations, such as form submissions. | 2896 // calls and navigations, such as form submissions. |
2898 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2897 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2899 bool force_swap_due_to_flag = | 2898 bool force_swap_due_to_flag = |
2900 command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || | 2899 command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3035 OpenURL(frame, url, Referrer(), default_policy); | 3034 OpenURL(frame, url, Referrer(), default_policy); |
3036 return WebKit::WebNavigationPolicyIgnore; | 3035 return WebKit::WebNavigationPolicyIgnore; |
3037 } | 3036 } |
3038 | 3037 |
3039 return default_policy; | 3038 return default_policy; |
3040 } | 3039 } |
3041 | 3040 |
3042 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 3041 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
3043 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 3042 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
3044 WebNavigationPolicy default_policy, bool is_redirect) { | 3043 WebNavigationPolicy default_policy, bool is_redirect) { |
3045 return decidePolicyForNavigation(frame, frame->provisionalDataSource(), | 3044 return decidePolicyForNavigation(frame, |
3045 frame->provisionalDataSource()->extraData(), | |
3046 request, type, default_policy, is_redirect); | 3046 request, type, default_policy, is_redirect); |
3047 } | 3047 } |
3048 | 3048 |
3049 bool RenderViewImpl::canHandleRequest( | 3049 bool RenderViewImpl::canHandleRequest( |
3050 WebFrame* frame, const WebURLRequest& request) { | 3050 WebFrame* frame, const WebURLRequest& request) { |
3051 // We allow WebKit to think that everything can be handled even though | 3051 // We allow WebKit to think that everything can be handled even though |
3052 // browser-side we limit what we load. | 3052 // browser-side we limit what we load. |
3053 return true; | 3053 return true; |
3054 } | 3054 } |
3055 | 3055 |
(...skipping 3447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6503 WebURL url = icon_urls[i].iconURL(); | 6503 WebURL url = icon_urls[i].iconURL(); |
6504 if (!url.isEmpty()) | 6504 if (!url.isEmpty()) |
6505 urls.push_back(FaviconURL(url, | 6505 urls.push_back(FaviconURL(url, |
6506 ToFaviconType(icon_urls[i].iconType()))); | 6506 ToFaviconType(icon_urls[i].iconType()))); |
6507 } | 6507 } |
6508 SendUpdateFaviconURL(urls); | 6508 SendUpdateFaviconURL(urls); |
6509 } | 6509 } |
6510 | 6510 |
6511 | 6511 |
6512 } // namespace content | 6512 } // namespace content |
OLD | NEW |