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/bind.h" | 10 #include "base/bind.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 #include "ui/gfx/point.h" | 176 #include "ui/gfx/point.h" |
177 #include "ui/gfx/rect.h" | 177 #include "ui/gfx/rect.h" |
178 #include "ui/gfx/size_conversions.h" | 178 #include "ui/gfx/size_conversions.h" |
179 #include "v8/include/v8.h" | 179 #include "v8/include/v8.h" |
180 #include "webkit/appcache/web_application_cache_host_impl.h" | 180 #include "webkit/appcache/web_application_cache_host_impl.h" |
181 #include "webkit/base/file_path_string_conversions.h" | 181 #include "webkit/base/file_path_string_conversions.h" |
182 #include "webkit/dom_storage/dom_storage_types.h" | 182 #include "webkit/dom_storage/dom_storage_types.h" |
183 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 183 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
184 #include "webkit/glue/dom_operations.h" | 184 #include "webkit/glue/dom_operations.h" |
185 #include "webkit/glue/glue_serialize.h" | 185 #include "webkit/glue/glue_serialize.h" |
186 #include "webkit/glue/resource_request_body.h" | |
186 #include "webkit/glue/web_intent_service_data.h" | 187 #include "webkit/glue/web_intent_service_data.h" |
187 #include "webkit/glue/webdropdata.h" | 188 #include "webkit/glue/webdropdata.h" |
188 #include "webkit/glue/webkit_constants.h" | 189 #include "webkit/glue/webkit_constants.h" |
189 #include "webkit/glue/webkit_glue.h" | 190 #include "webkit/glue/webkit_glue.h" |
190 #include "webkit/glue/weburlresponse_extradata_impl.h" | 191 #include "webkit/glue/weburlresponse_extradata_impl.h" |
191 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 192 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
192 #include "webkit/media/webmediaplayer_impl.h" | 193 #include "webkit/media/webmediaplayer_impl.h" |
193 #include "webkit/media/webmediaplayer_ms.h" | 194 #include "webkit/media/webmediaplayer_ms.h" |
194 #include "webkit/plugins/npapi/plugin_list.h" | 195 #include "webkit/plugins/npapi/plugin_list.h" |
195 #include "webkit/plugins/npapi/webplugin_delegate.h" | 196 #include "webkit/plugins/npapi/webplugin_delegate.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 using WebKit::WebVector; | 312 using WebKit::WebVector; |
312 using WebKit::WebView; | 313 using WebKit::WebView; |
313 using WebKit::WebWidget; | 314 using WebKit::WebWidget; |
314 using WebKit::WebWindowFeatures; | 315 using WebKit::WebWindowFeatures; |
315 using appcache::WebApplicationCacheHostImpl; | 316 using appcache::WebApplicationCacheHostImpl; |
316 using base::Time; | 317 using base::Time; |
317 using base::TimeDelta; | 318 using base::TimeDelta; |
318 | 319 |
319 using webkit_glue::AltErrorPageResourceFetcher; | 320 using webkit_glue::AltErrorPageResourceFetcher; |
320 using webkit_glue::ResourceFetcher; | 321 using webkit_glue::ResourceFetcher; |
322 using webkit_glue::ResourceRequestBody; | |
321 using webkit_glue::WebPreferences; | 323 using webkit_glue::WebPreferences; |
322 using webkit_glue::WebURLResponseExtraDataImpl; | 324 using webkit_glue::WebURLResponseExtraDataImpl; |
323 | 325 |
324 #if defined(OS_ANDROID) | 326 #if defined(OS_ANDROID) |
325 using WebKit::WebContentDetectionResult; | 327 using WebKit::WebContentDetectionResult; |
326 using WebKit::WebFloatPoint; | 328 using WebKit::WebFloatPoint; |
327 using WebKit::WebFloatRect; | 329 using WebKit::WebFloatRect; |
328 using WebKit::WebHitTestResult; | 330 using WebKit::WebHitTestResult; |
329 #endif | 331 #endif |
330 | 332 |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1129 | 1131 |
1130 if (!params.extra_headers.empty()) { | 1132 if (!params.extra_headers.empty()) { |
1131 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), | 1133 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), |
1132 params.extra_headers.end(), "\n"); | 1134 params.extra_headers.end(), "\n"); |
1133 i.GetNext(); ) { | 1135 i.GetNext(); ) { |
1134 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), | 1136 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), |
1135 WebString::fromUTF8(i.values())); | 1137 WebString::fromUTF8(i.values())); |
1136 } | 1138 } |
1137 } | 1139 } |
1138 | 1140 |
1139 if (params.is_post) { | 1141 if(params.is_post) { |
Charlie Reis
2012/11/20 05:46:03
nit: Space after if.
irobert
2012/11/22 01:37:00
Done.
| |
1140 request.setHTTPMethod(WebString::fromUTF8("POST")); | |
1141 | |
1142 // Set post data. | |
1143 WebHTTPBody http_body; | 1142 WebHTTPBody http_body; |
1144 http_body.initialize(); | 1143 http_body.initialize(); |
1145 http_body.appendData(WebData( | 1144 const std::vector<ResourceRequestBody::Element>* uploads = |
Charlie Reis
2012/11/20 05:46:03
Note: this file still needs more review. I haven'
| |
1146 reinterpret_cast<const char*>( | 1145 params.browser_initiated_post_data->elements(); |
1147 ¶ms.browser_initiated_post_data.front()), | 1146 std::vector<ResourceRequestBody::Element>::const_iterator iter; |
1148 params.browser_initiated_post_data.size())); | 1147 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { |
1148 switch (iter->type()) { | |
1149 case ResourceRequestBody::Element::TYPE_BYTES: { | |
1150 http_body.appendData(WebData(iter->bytes(), | |
1151 static_cast<int>(iter->length()))); | |
1152 break; | |
1153 } | |
1154 case ResourceRequestBody::Element::TYPE_FILE: { | |
1155 #if defined(OS_POSIX) | |
1156 WebString filePath = WideToUTF16Hack( | |
1157 base::SysNativeMBToWide(iter->path().value())); | |
1158 #elif defined(OS_WIN) | |
1159 WebString filePath = WideToUTF16Hack(iter->path().value()); | |
1160 #endif | |
1161 http_body.appendFileRange( | |
1162 filePath, | |
1163 static_cast<long long>(iter->offset()), | |
1164 static_cast<long long>(iter->length()), | |
1165 iter->expected_modification_time().ToDoubleT()); | |
1166 break; | |
1167 } | |
1168 case ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM: { | |
1169 CHECK(false); | |
1170 break; | |
1171 } | |
1172 case ResourceRequestBody::Element:: TYPE_BLOB: { | |
1173 CHECK(false); | |
1174 break; | |
1175 } | |
1176 default: | |
1177 NOTREACHED(); | |
1178 } | |
1179 } | |
1149 request.setHTTPBody(http_body); | 1180 request.setHTTPBody(http_body); |
1181 request.setHTTPMethod(WebString::fromUTF8("POST")); | |
1182 request.setHTTPHeaderField( | |
1183 WebString::fromUTF8("Content-Type"), | |
1184 WebString::fromUTF8(params.extra_headers)); | |
1150 } | 1185 } |
1151 | |
1152 main_frame->loadRequest(request); | 1186 main_frame->loadRequest(request); |
1153 } | 1187 } |
1154 | |
1155 // In case LoadRequest failed before DidCreateDataSource was called. | 1188 // In case LoadRequest failed before DidCreateDataSource was called. |
1156 pending_navigation_params_.reset(); | 1189 pending_navigation_params_.reset(); |
1157 } | 1190 } |
1158 | 1191 |
1159 bool RenderViewImpl::IsBackForwardToStaleEntry( | 1192 bool RenderViewImpl::IsBackForwardToStaleEntry( |
1160 const ViewMsg_Navigate_Params& params, | 1193 const ViewMsg_Navigate_Params& params, |
1161 bool is_reload) { | 1194 bool is_reload) { |
1162 // Make sure this isn't a back/forward to an entry we have already cropped | 1195 // Make sure this isn't a back/forward to an entry we have already cropped |
1163 // or replaced from our history, before the browser knew about it. If so, | 1196 // or replaced from our history, before the browser knew about it. If so, |
1164 // a new navigation has committed in the mean time, and we can ignore this. | 1197 // a new navigation has committed in the mean time, and we can ignore this. |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1652 if (item.urlString() == WebString::fromUTF8(kSwappedOutURL)) | 1685 if (item.urlString() == WebString::fromUTF8(kSwappedOutURL)) |
1653 return; | 1686 return; |
1654 | 1687 |
1655 Send(new ViewHostMsg_UpdateState( | 1688 Send(new ViewHostMsg_UpdateState( |
1656 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 1689 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
1657 } | 1690 } |
1658 | 1691 |
1659 void RenderViewImpl::OpenURL(WebFrame* frame, | 1692 void RenderViewImpl::OpenURL(WebFrame* frame, |
1660 const GURL& url, | 1693 const GURL& url, |
1661 const Referrer& referrer, | 1694 const Referrer& referrer, |
1662 WebNavigationPolicy policy) { | 1695 WebNavigationPolicy policy, |
1696 std::string extra_header, | |
1697 scoped_refptr<ResourceRequestBody> | |
1698 request_body) { | |
1663 ViewHostMsg_OpenURL_Params params; | 1699 ViewHostMsg_OpenURL_Params params; |
1664 params.url = url; | 1700 params.url = url; |
1665 params.referrer = referrer; | 1701 params.referrer = referrer; |
1666 params.disposition = NavigationPolicyToDisposition(policy); | 1702 params.disposition = NavigationPolicyToDisposition(policy); |
1667 params.frame_id = frame->identifier(); | 1703 params.frame_id = frame->identifier(); |
1704 params.extra_header = extra_header; | |
1705 params.request_body = request_body; | |
1706 | |
1668 DocumentState* document_state = | 1707 DocumentState* document_state = |
1669 DocumentState::FromDataSource(frame->dataSource()); | 1708 DocumentState::FromDataSource(frame->dataSource()); |
1670 params.is_cross_site_redirect = | 1709 params.is_cross_site_redirect = |
1671 document_state->navigation_state()->is_redirect_in_progress(); | 1710 document_state->navigation_state()->is_redirect_in_progress(); |
1672 | |
1673 Send(new ViewHostMsg_OpenURL(routing_id_, params)); | 1711 Send(new ViewHostMsg_OpenURL(routing_id_, params)); |
1674 } | 1712 } |
1675 | 1713 |
1676 // WebViewDelegate ------------------------------------------------------------ | 1714 // WebViewDelegate ------------------------------------------------------------ |
1677 | 1715 |
1678 void RenderViewImpl::LoadNavigationErrorPage( | 1716 void RenderViewImpl::LoadNavigationErrorPage( |
1679 WebFrame* frame, | 1717 WebFrame* frame, |
1680 const WebURLRequest& failed_request, | 1718 const WebURLRequest& failed_request, |
1681 const WebURLError& error, | 1719 const WebURLError& error, |
1682 const std::string& html, | 1720 const std::string& html, |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2669 WebFrame* frame, const WebURLRequest& request, | 2707 WebFrame* frame, const WebURLRequest& request, |
2670 WebNavigationPolicy policy, | 2708 WebNavigationPolicy policy, |
2671 const WebString& suggested_name) { | 2709 const WebString& suggested_name) { |
2672 Referrer referrer( | 2710 Referrer referrer( |
2673 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2711 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2674 GetReferrerPolicyFromRequest(frame, request)); | 2712 GetReferrerPolicyFromRequest(frame, request)); |
2675 if (policy == WebKit::WebNavigationPolicyDownload) { | 2713 if (policy == WebKit::WebNavigationPolicyDownload) { |
2676 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2714 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
2677 suggested_name)); | 2715 suggested_name)); |
2678 } else { | 2716 } else { |
2679 OpenURL(frame, request.url(), referrer, policy); | 2717 OpenURL(frame, request.url(), referrer, policy, std::string(""), NULL); |
Charlie Reis
2012/11/20 05:46:03
nit: No quotes.
irobert
2012/11/22 01:37:00
Done.
| |
2680 } | 2718 } |
2681 } | 2719 } |
2682 | 2720 |
2683 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 2721 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
2684 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 2722 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
2685 const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { | 2723 const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { |
2686 if (request.url() != GURL(kSwappedOutURL) && | 2724 if (request.url() != GURL(kSwappedOutURL) && |
2687 GetContentClient()->renderer()->HandleNavigation(frame, request, type, | 2725 GetContentClient()->renderer()->HandleNavigation(frame, request, type, |
2688 default_policy, | 2726 default_policy, |
2689 is_redirect)) { | 2727 is_redirect)) { |
2690 return WebKit::WebNavigationPolicyIgnore; | 2728 return WebKit::WebNavigationPolicyIgnore; |
2691 } | 2729 } |
2692 | 2730 |
2693 Referrer referrer( | 2731 Referrer referrer( |
2694 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2732 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2695 GetReferrerPolicyFromRequest(frame, request)); | 2733 GetReferrerPolicyFromRequest(frame, request)); |
2696 | 2734 |
2735 std::string header; | |
Charlie Reis
2012/11/20 05:46:03
Can this be moved to a helper function?
| |
2736 scoped_refptr<ResourceRequestBody> request_body = NULL; | |
2737 if(request.httpMethod() == WebString("POST") && | |
2738 !request.httpBody().isNull()) { | |
2739 request_body = new ResourceRequestBody(); | |
2740 WebHTTPBody body = request.httpBody(); | |
2741 WebKit::WebHTTPBody::Element element; | |
2742 for (int i=0; body.elementAt(i, element); i++) { | |
2743 switch (element.type) { | |
2744 case WebHTTPBody::Element::TypeData: { | |
2745 if (!element.data.isEmpty()) | |
2746 request_body->AppendBytes(element.data.data(), | |
2747 static_cast<int>(element.data.size())); | |
2748 break; | |
2749 } | |
2750 case WebHTTPBody::Element::TypeFile: { | |
2751 #if defined(OS_POSIX) | |
2752 const FilePath::StringType kFilePath = | |
2753 base::SysWideToNativeMB(UTF16ToWideHack(element.filePath)); | |
2754 #elif defined(OS_WIN) | |
2755 const FilePath::StringType kFilePath = | |
2756 UTF16ToWideHack(element.filePath); | |
2757 #endif | |
2758 if (element.fileLength == -1) { | |
2759 request_body->AppendFileRange( | |
2760 FilePath(kFilePath), 0, kuint64max, base::Time()); | |
2761 } else { | |
2762 request_body->AppendFileRange( | |
2763 FilePath(kFilePath), | |
2764 static_cast<uint64>(element.fileStart), | |
2765 static_cast<uint64>(element.fileLength), | |
2766 base::Time::FromDoubleT(element.modificationTime)); | |
2767 } | |
2768 break; | |
2769 } | |
2770 case WebHTTPBody::Element::TypeURL: { | |
2771 CHECK(false); | |
2772 break; | |
2773 } | |
2774 case WebHTTPBody::Element::TypeBlob: { | |
2775 CHECK(false); | |
2776 break; | |
2777 } | |
2778 default: | |
2779 NOTREACHED(); | |
2780 } | |
2781 } | |
2782 // Extract Header Info. | |
2783 WebString ContentType = | |
2784 request.httpHeaderField(WebString::fromUTF8("Content-Type")); | |
2785 header.assign(ContentType.utf8().data(), ContentType.utf8().length()); | |
2786 } | |
2787 | |
2697 if (is_swapped_out_) { | 2788 if (is_swapped_out_) { |
2698 if (request.url() != GURL(kSwappedOutURL)) { | 2789 if (request.url() != GURL(kSwappedOutURL)) { |
2699 // Targeted links may try to navigate a swapped out frame. Allow the | 2790 // Targeted links may try to navigate a swapped out frame. Allow the |
2700 // browser process to navigate the tab instead. Note that it is also | 2791 // browser process to navigate the tab instead. Note that it is also |
2701 // possible for non-targeted navigations (from this view) to arrive | 2792 // possible for non-targeted navigations (from this view) to arrive |
2702 // here just after we are swapped out. It's ok to send them to the | 2793 // here just after we are swapped out. It's ok to send them to the |
2703 // browser, as long as they're for the top level frame. | 2794 // browser, as long as they're for the top level frame. |
2704 // TODO(creis): Ensure this supports targeted form submissions when | 2795 // TODO(creis): Ensure this supports targeted form submissions when |
2705 // fixing http://crbug.com/101395. | 2796 // fixing http://crbug.com/101395. |
2706 if (frame->parent() == NULL) { | 2797 if (frame->parent() == NULL) { |
2707 OpenURL(frame, request.url(), referrer, default_policy); | 2798 OpenURL(frame, request.url(), referrer, |
2799 default_policy, header, request_body); | |
2708 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2800 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2709 } | 2801 } |
2710 | |
2711 // We should otherwise ignore in-process iframe navigations, if they | 2802 // We should otherwise ignore in-process iframe navigations, if they |
2712 // arrive just after we are swapped out. | 2803 // arrive just after we are swapped out. |
2713 return WebKit::WebNavigationPolicyIgnore; | 2804 return WebKit::WebNavigationPolicyIgnore; |
2714 } | 2805 } |
2715 | 2806 |
2716 // Allow kSwappedOutURL to complete. | 2807 // Allow kSwappedOutURL to complete. |
2717 return default_policy; | 2808 return default_policy; |
2718 } | 2809 } |
2719 | 2810 |
2720 // Webkit is asking whether to navigate to a new URL. | 2811 // Webkit is asking whether to navigate to a new URL. |
(...skipping 18 matching lines...) Expand all Loading... | |
2739 command_line.HasSwitch(switches::kSitePerProcess); | 2830 command_line.HasSwitch(switches::kSitePerProcess); |
2740 if (force_swap_due_to_flag && | 2831 if (force_swap_due_to_flag && |
2741 !frame->parent() && (is_content_initiated || is_redirect)) { | 2832 !frame->parent() && (is_content_initiated || is_redirect)) { |
2742 WebString origin_str = frame->document().securityOrigin().toString(); | 2833 WebString origin_str = frame->document().securityOrigin().toString(); |
2743 GURL frame_url(origin_str.utf8().data()); | 2834 GURL frame_url(origin_str.utf8().data()); |
2744 // TODO(cevans): revisit whether this site check is still necessary once | 2835 // TODO(cevans): revisit whether this site check is still necessary once |
2745 // crbug.com/101395 is fixed. | 2836 // crbug.com/101395 is fixed. |
2746 if (!net::RegistryControlledDomainService::SameDomainOrHost(frame_url, | 2837 if (!net::RegistryControlledDomainService::SameDomainOrHost(frame_url, |
2747 url) || | 2838 url) || |
2748 frame_url.scheme() != url.scheme()) { | 2839 frame_url.scheme() != url.scheme()) { |
2749 OpenURL(frame, url, referrer, default_policy); | 2840 OpenURL(frame, url, referrer, default_policy, header, request_body); |
2750 return WebKit::WebNavigationPolicyIgnore; | 2841 return WebKit::WebNavigationPolicyIgnore; |
2751 } | 2842 } |
2752 } | 2843 } |
2753 | 2844 |
2754 // If the browser is interested, then give it a chance to look at the request. | 2845 // If the browser is interested, then give it a chance to look at the request. |
2755 if (is_content_initiated) { | 2846 if (is_content_initiated) { |
2756 bool browser_handles_request = | 2847 bool browser_handles_request = |
2757 renderer_preferences_.browser_handles_non_local_top_level_requests && | 2848 renderer_preferences_.browser_handles_non_local_top_level_requests && |
2758 IsNonLocalTopLevelNavigation(url, frame, type); | 2849 IsNonLocalTopLevelNavigation(url, frame, type); |
2759 if (!browser_handles_request) { | 2850 if (!browser_handles_request) { |
2760 browser_handles_request = | 2851 browser_handles_request = |
2761 renderer_preferences_.browser_handles_all_top_level_requests && | 2852 renderer_preferences_.browser_handles_all_top_level_requests && |
2762 IsTopLevelNavigation(frame); | 2853 IsTopLevelNavigation(frame); |
2763 } | 2854 } |
2764 | 2855 |
2765 if (browser_handles_request) { | 2856 if (browser_handles_request) { |
2766 // Reset these counters as the RenderView could be reused for the next | 2857 // Reset these counters as the RenderView could be reused for the next |
2767 // navigation. | 2858 // navigation. |
2768 page_id_ = -1; | 2859 page_id_ = -1; |
2769 last_page_id_sent_to_browser_ = -1; | 2860 last_page_id_sent_to_browser_ = -1; |
2770 OpenURL(frame, url, referrer, default_policy); | 2861 OpenURL(frame, url, referrer, default_policy, header, request_body); |
2771 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2862 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2772 } | 2863 } |
2773 } | 2864 } |
2774 | 2865 |
2775 // Use the frame's original request's URL rather than the document's URL for | 2866 // Use the frame's original request's URL rather than the document's URL for |
2776 // subsequent checks. For a popup, the document's URL may become the opener | 2867 // subsequent checks. For a popup, the document's URL may become the opener |
2777 // window's URL if the opener has called document.write(). | 2868 // window's URL if the opener has called document.write(). |
2778 // See http://crbug.com/93517. | 2869 // See http://crbug.com/93517. |
2779 GURL old_url(frame->dataSource()->request().url()); | 2870 GURL old_url(frame->dataSource()->request().url()); |
2780 | 2871 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2822 DCHECK(!source_url.is_empty()); | 2913 DCHECK(!source_url.is_empty()); |
2823 should_fork = !source_url.SchemeIs(chrome::kFileScheme); | 2914 should_fork = !source_url.SchemeIs(chrome::kFileScheme); |
2824 } | 2915 } |
2825 | 2916 |
2826 if (!should_fork) { | 2917 if (!should_fork) { |
2827 // Give the embedder a chance. | 2918 // Give the embedder a chance. |
2828 // For now, we skip this for POST submissions. This is because | 2919 // For now, we skip this for POST submissions. This is because |
2829 // http://crbug.com/101395 is more likely to cause compatibility issues | 2920 // http://crbug.com/101395 is more likely to cause compatibility issues |
2830 // with hosted apps and extensions than WebUI pages. We will remove this | 2921 // with hosted apps and extensions than WebUI pages. We will remove this |
2831 // check when cross-process POST submissions are supported. | 2922 // check when cross-process POST submissions are supported. |
2832 if (request.httpMethod() == "GET") { | |
2833 should_fork = GetContentClient()->renderer()->ShouldFork( | 2923 should_fork = GetContentClient()->renderer()->ShouldFork( |
2834 frame, url, is_initial_navigation, &send_referrer); | 2924 frame, url, is_initial_navigation, &send_referrer); |
2835 } | |
2836 } | 2925 } |
2837 | 2926 |
2838 if (should_fork) { | 2927 if (should_fork) { |
2839 OpenURL( | 2928 OpenURL(frame, url, send_referrer ? referrer : Referrer(), |
2840 frame, url, send_referrer ? referrer : Referrer(), default_policy); | 2929 default_policy, header, request_body); |
2841 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2930 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2842 } | 2931 } |
2843 } | 2932 } |
2844 | 2933 |
2845 // Detect when a page is "forking" a new tab that can be safely rendered in | 2934 // Detect when a page is "forking" a new tab that can be safely rendered in |
2846 // its own process. This is done by sites like Gmail that try to open links | 2935 // its own process. This is done by sites like Gmail that try to open links |
2847 // in new windows without script connections back to the original page. We | 2936 // in new windows without script connections back to the original page. We |
2848 // treat such cases as browser navigations (in which we will create a new | 2937 // treat such cases as browser navigations (in which we will create a new |
2849 // renderer for a cross-site navigation), rather than WebKit navigations. | 2938 // renderer for a cross-site navigation), rather than WebKit navigations. |
2850 // | 2939 // |
(...skipping 18 matching lines...) Expand all Loading... | |
2869 frame->parent() == NULL && | 2958 frame->parent() == NULL && |
2870 // Must not have issued the request from this page. | 2959 // Must not have issued the request from this page. |
2871 is_content_initiated && | 2960 is_content_initiated && |
2872 // Must be targeted at the current tab. | 2961 // Must be targeted at the current tab. |
2873 default_policy == WebKit::WebNavigationPolicyCurrentTab && | 2962 default_policy == WebKit::WebNavigationPolicyCurrentTab && |
2874 // Must be a JavaScript navigation, which appears as "other". | 2963 // Must be a JavaScript navigation, which appears as "other". |
2875 type == WebKit::WebNavigationTypeOther; | 2964 type == WebKit::WebNavigationTypeOther; |
2876 | 2965 |
2877 if (is_fork) { | 2966 if (is_fork) { |
2878 // Open the URL via the browser, not via WebKit. | 2967 // Open the URL via the browser, not via WebKit. |
2879 OpenURL(frame, url, Referrer(), default_policy); | 2968 OpenURL(frame, url, Referrer(), default_policy, header, request_body); |
2880 return WebKit::WebNavigationPolicyIgnore; | 2969 return WebKit::WebNavigationPolicyIgnore; |
2881 } | 2970 } |
2882 | |
2883 return default_policy; | 2971 return default_policy; |
2884 } | 2972 } |
2885 | 2973 |
2886 bool RenderViewImpl::canHandleRequest( | 2974 bool RenderViewImpl::canHandleRequest( |
2887 WebFrame* frame, const WebURLRequest& request) { | 2975 WebFrame* frame, const WebURLRequest& request) { |
2888 // We allow WebKit to think that everything can be handled even though | 2976 // We allow WebKit to think that everything can be handled even though |
2889 // browser-side we limit what we load. | 2977 // browser-side we limit what we load. |
2890 return true; | 2978 return true; |
2891 } | 2979 } |
2892 | 2980 |
(...skipping 3516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6409 } | 6497 } |
6410 #endif | 6498 #endif |
6411 | 6499 |
6412 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6500 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6413 TransportDIB::Handle dib_handle) { | 6501 TransportDIB::Handle dib_handle) { |
6414 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6502 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6415 RenderProcess::current()->ReleaseTransportDIB(dib); | 6503 RenderProcess::current()->ReleaseTransportDIB(dib); |
6416 } | 6504 } |
6417 | 6505 |
6418 } // namespace content | 6506 } // namespace content |
OLD | NEW |