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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 14188060: Change decidePolicyForNavigation() to takea WebDataSource::ExtraData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | webkit/tools/test_shell/test_webview_delegate.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 (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 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 GetReferrerPolicyFromRequest(frame, request)); 2841 GetReferrerPolicyFromRequest(frame, request));
2842 if (policy == WebKit::WebNavigationPolicyDownload) { 2842 if (policy == WebKit::WebNavigationPolicyDownload) {
2843 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, 2843 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer,
2844 suggested_name)); 2844 suggested_name));
2845 } else { 2845 } else {
2846 OpenURL(frame, request.url(), referrer, policy); 2846 OpenURL(frame, request.url(), referrer, policy);
2847 } 2847 }
2848 } 2848 }
2849 2849
2850 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( 2850 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
2851 WebFrame* frame, WebDataSource* dataSource, const WebURLRequest& request, 2851 WebFrame* frame, WebDataSource::ExtraData* extraData,
2852 WebNavigationType type, WebNavigationPolicy default_policy, 2852 const WebURLRequest& request, WebNavigationType type,
2853 bool is_redirect) { 2853 WebNavigationPolicy default_policy, bool is_redirect) {
2854 if (request.url() != GURL(kSwappedOutURL) && 2854 if (request.url() != GURL(kSwappedOutURL) &&
2855 GetContentClient()->renderer()->HandleNavigation(frame, request, type, 2855 GetContentClient()->renderer()->HandleNavigation(frame, request, type,
2856 default_policy, 2856 default_policy,
2857 is_redirect)) { 2857 is_redirect)) {
2858 return WebKit::WebNavigationPolicyIgnore; 2858 return WebKit::WebNavigationPolicyIgnore;
2859 } 2859 }
2860 2860
2861 Referrer referrer( 2861 Referrer referrer(
2862 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), 2862 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
2863 GetReferrerPolicyFromRequest(frame, request)); 2863 GetReferrerPolicyFromRequest(frame, request));
(...skipping 21 matching lines...) Expand all
2885 return default_policy; 2885 return default_policy;
2886 } 2886 }
2887 2887
2888 // Webkit is asking whether to navigate to a new URL. 2888 // Webkit is asking whether to navigate to a new URL.
2889 // This is fine normally, except if we're showing UI from one security 2889 // This is fine normally, except if we're showing UI from one security
2890 // context and they're trying to navigate to a different context. 2890 // context and they're trying to navigate to a different context.
2891 const GURL& url = request.url(); 2891 const GURL& url = request.url();
2892 2892
2893 // A content initiated navigation may have originated from a link-click, 2893 // A content initiated navigation may have originated from a link-click,
2894 // script, drag-n-drop operation, etc. 2894 // script, drag-n-drop operation, etc.
2895 bool is_content_initiated = 2895 bool is_content_initiated = static_cast<DocumentState*>(extraData)->
2896 DocumentState::FromDataSource(dataSource)->
2897 navigation_state()->is_content_initiated(); 2896 navigation_state()->is_content_initiated();
2898 2897
2899 // Experimental: 2898 // Experimental:
2900 // If --enable-strict-site-isolation or --site-per-process is enabled, send 2899 // If --enable-strict-site-isolation or --site-per-process is enabled, send
2901 // all top-level navigations to the browser to let it swap processes when 2900 // all top-level navigations to the browser to let it swap processes when
2902 // crossing site boundaries. This is currently expected to break some script 2901 // crossing site boundaries. This is currently expected to break some script
2903 // calls and navigations, such as form submissions. 2902 // calls and navigations, such as form submissions.
2904 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 2903 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
2905 bool force_swap_due_to_flag = 2904 bool force_swap_due_to_flag =
2906 command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || 2905 command_line.HasSwitch(switches::kEnableStrictSiteIsolation) ||
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3041 OpenURL(frame, url, Referrer(), default_policy); 3040 OpenURL(frame, url, Referrer(), default_policy);
3042 return WebKit::WebNavigationPolicyIgnore; 3041 return WebKit::WebNavigationPolicyIgnore;
3043 } 3042 }
3044 3043
3045 return default_policy; 3044 return default_policy;
3046 } 3045 }
3047 3046
3048 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( 3047 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
3049 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, 3048 WebFrame* frame, const WebURLRequest& request, WebNavigationType type,
3050 WebNavigationPolicy default_policy, bool is_redirect) { 3049 WebNavigationPolicy default_policy, bool is_redirect) {
3051 return decidePolicyForNavigation(frame, frame->provisionalDataSource(), 3050 return decidePolicyForNavigation(frame,
3051 frame->provisionalDataSource()->extraData(),
3052 request, type, default_policy, is_redirect); 3052 request, type, default_policy, is_redirect);
3053 } 3053 }
3054 3054
3055 bool RenderViewImpl::canHandleRequest( 3055 bool RenderViewImpl::canHandleRequest(
3056 WebFrame* frame, const WebURLRequest& request) { 3056 WebFrame* frame, const WebURLRequest& request) {
3057 // We allow WebKit to think that everything can be handled even though 3057 // We allow WebKit to think that everything can be handled even though
3058 // browser-side we limit what we load. 3058 // browser-side we limit what we load.
3059 return true; 3059 return true;
3060 } 3060 }
3061 3061
(...skipping 3447 matching lines...) Expand 10 before | Expand all | Expand 10 after
6509 WebURL url = icon_urls[i].iconURL(); 6509 WebURL url = icon_urls[i].iconURL();
6510 if (!url.isEmpty()) 6510 if (!url.isEmpty())
6511 urls.push_back(FaviconURL(url, 6511 urls.push_back(FaviconURL(url,
6512 ToFaviconType(icon_urls[i].iconType()))); 6512 ToFaviconType(icon_urls[i].iconType())));
6513 } 6513 }
6514 SendUpdateFaviconURL(urls); 6514 SendUpdateFaviconURL(urls);
6515 } 6515 }
6516 6516
6517 6517
6518 } // namespace content 6518 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698