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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 #include "ui/gfx/point.h" | 178 #include "ui/gfx/point.h" |
179 #include "ui/gfx/rect.h" | 179 #include "ui/gfx/rect.h" |
180 #include "ui/gfx/size_conversions.h" | 180 #include "ui/gfx/size_conversions.h" |
181 #include "v8/include/v8.h" | 181 #include "v8/include/v8.h" |
182 #include "webkit/appcache/web_application_cache_host_impl.h" | 182 #include "webkit/appcache/web_application_cache_host_impl.h" |
183 #include "webkit/base/file_path_string_conversions.h" | 183 #include "webkit/base/file_path_string_conversions.h" |
184 #include "webkit/dom_storage/dom_storage_types.h" | 184 #include "webkit/dom_storage/dom_storage_types.h" |
185 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 185 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
186 #include "webkit/glue/dom_operations.h" | 186 #include "webkit/glue/dom_operations.h" |
187 #include "webkit/glue/glue_serialize.h" | 187 #include "webkit/glue/glue_serialize.h" |
| 188 #include "webkit/glue/resource_request_body.h" |
188 #include "webkit/glue/web_intent_service_data.h" | 189 #include "webkit/glue/web_intent_service_data.h" |
189 #include "webkit/glue/webdropdata.h" | 190 #include "webkit/glue/webdropdata.h" |
190 #include "webkit/glue/webkit_constants.h" | 191 #include "webkit/glue/webkit_constants.h" |
191 #include "webkit/glue/webkit_glue.h" | 192 #include "webkit/glue/webkit_glue.h" |
192 #include "webkit/glue/weburlresponse_extradata_impl.h" | 193 #include "webkit/glue/weburlresponse_extradata_impl.h" |
193 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 194 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
194 #include "webkit/media/webmediaplayer_impl.h" | 195 #include "webkit/media/webmediaplayer_impl.h" |
195 #include "webkit/media/webmediaplayer_ms.h" | 196 #include "webkit/media/webmediaplayer_ms.h" |
196 #include "webkit/plugins/npapi/plugin_list.h" | 197 #include "webkit/plugins/npapi/plugin_list.h" |
197 #include "webkit/plugins/npapi/webplugin_delegate.h" | 198 #include "webkit/plugins/npapi/webplugin_delegate.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 using WebKit::WebVector; | 314 using WebKit::WebVector; |
314 using WebKit::WebView; | 315 using WebKit::WebView; |
315 using WebKit::WebWidget; | 316 using WebKit::WebWidget; |
316 using WebKit::WebWindowFeatures; | 317 using WebKit::WebWindowFeatures; |
317 using appcache::WebApplicationCacheHostImpl; | 318 using appcache::WebApplicationCacheHostImpl; |
318 using base::Time; | 319 using base::Time; |
319 using base::TimeDelta; | 320 using base::TimeDelta; |
320 | 321 |
321 using webkit_glue::AltErrorPageResourceFetcher; | 322 using webkit_glue::AltErrorPageResourceFetcher; |
322 using webkit_glue::ResourceFetcher; | 323 using webkit_glue::ResourceFetcher; |
| 324 using webkit_glue::ResourceRequestBody; |
323 using webkit_glue::WebPreferences; | 325 using webkit_glue::WebPreferences; |
324 using webkit_glue::WebURLResponseExtraDataImpl; | 326 using webkit_glue::WebURLResponseExtraDataImpl; |
325 | 327 |
326 #if defined(OS_ANDROID) | 328 #if defined(OS_ANDROID) |
327 using WebKit::WebContentDetectionResult; | 329 using WebKit::WebContentDetectionResult; |
328 using WebKit::WebFloatPoint; | 330 using WebKit::WebFloatPoint; |
329 using WebKit::WebFloatRect; | 331 using WebKit::WebFloatRect; |
330 using WebKit::WebHitTestResult; | 332 using WebKit::WebHitTestResult; |
331 #endif | 333 #endif |
332 | 334 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 ds->redirectChain(urls); | 388 ds->redirectChain(urls); |
387 result->reserve(urls.size()); | 389 result->reserve(urls.size()); |
388 for (size_t i = 0; i < urls.size(); ++i) { | 390 for (size_t i = 0; i < urls.size(); ++i) { |
389 if (urls[i] != GURL(kSwappedOutURL)) | 391 if (urls[i] != GURL(kSwappedOutURL)) |
390 result->push_back(urls[i]); | 392 result->push_back(urls[i]); |
391 else | 393 else |
392 result->push_back(blank_url); | 394 result->push_back(blank_url); |
393 } | 395 } |
394 } | 396 } |
395 | 397 |
| 398 static scoped_refptr<ResourceRequestBody> ConstructResourceRequestBody( |
| 399 const WebURLRequest request) { |
| 400 if (request.httpMethod() != WebString("POST") || |
| 401 request.httpBody().isNull()) |
| 402 return NULL; |
| 403 |
| 404 scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody; |
| 405 WebHTTPBody body = request.httpBody(); |
| 406 WebKit::WebHTTPBody::Element element; |
| 407 for (int i=0; body.elementAt(i, element); i++) { |
| 408 switch (element.type) { |
| 409 case WebHTTPBody::Element::TypeData: { |
| 410 if (!element.data.isEmpty()) |
| 411 request_body->AppendBytes(element.data.data(), |
| 412 static_cast<int>(element.data.size())); |
| 413 break; |
| 414 } |
| 415 case WebHTTPBody::Element::TypeFile: { |
| 416 #if defined(OS_POSIX) |
| 417 const FilePath::StringType kFilePath = |
| 418 base::SysWideToNativeMB(UTF16ToWideHack(element.filePath)); |
| 419 #elif defined(OS_WIN) |
| 420 const FilePath::StringType kFilePath = |
| 421 UTF16ToWideHack(element.filePath); |
| 422 #endif |
| 423 if (element.fileLength == -1) { |
| 424 request_body->AppendFileRange( |
| 425 FilePath(kFilePath), 0, kuint64max, base::Time()); |
| 426 } else { |
| 427 request_body->AppendFileRange( |
| 428 FilePath(kFilePath), |
| 429 static_cast<uint64>(element.fileStart), |
| 430 static_cast<uint64>(element.fileLength), |
| 431 base::Time::FromDoubleT(element.modificationTime)); |
| 432 } |
| 433 break; |
| 434 } |
| 435 // We do not support TypeURL POST data since it not possible |
| 436 // to make a cross-process POST navigation with this type. |
| 437 case WebHTTPBody::Element::TypeURL: { |
| 438 CHECK(false); |
| 439 break; |
| 440 } |
| 441 // We do not support TypeBlob POST data since it not possible |
| 442 // to make a cross-process POST navigation with this type. |
| 443 case WebHTTPBody::Element::TypeBlob: { |
| 444 CHECK(false); |
| 445 break; |
| 446 } |
| 447 default: |
| 448 NOTREACHED(); |
| 449 } |
| 450 } |
| 451 return request_body; |
| 452 } |
| 453 |
396 // If |data_source| is non-null and has a DocumentState associated with it, | 454 // If |data_source| is non-null and has a DocumentState associated with it, |
397 // the AltErrorPageResourceFetcher is reset. | 455 // the AltErrorPageResourceFetcher is reset. |
398 static void StopAltErrorPageFetcher(WebDataSource* data_source) { | 456 static void StopAltErrorPageFetcher(WebDataSource* data_source) { |
399 if (data_source) { | 457 if (data_source) { |
400 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 458 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
401 if (document_state) | 459 if (document_state) |
402 document_state->set_alt_error_page_fetcher(NULL); | 460 document_state->set_alt_error_page_fetcher(NULL); |
403 } | 461 } |
404 } | 462 } |
405 | 463 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 if (!params.extra_headers.empty()) { | 1191 if (!params.extra_headers.empty()) { |
1134 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), | 1192 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), |
1135 params.extra_headers.end(), "\n"); | 1193 params.extra_headers.end(), "\n"); |
1136 i.GetNext(); ) { | 1194 i.GetNext(); ) { |
1137 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), | 1195 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), |
1138 WebString::fromUTF8(i.values())); | 1196 WebString::fromUTF8(i.values())); |
1139 } | 1197 } |
1140 } | 1198 } |
1141 | 1199 |
1142 if (params.is_post) { | 1200 if (params.is_post) { |
1143 request.setHTTPMethod(WebString::fromUTF8("POST")); | |
1144 | |
1145 // Set post data. | |
1146 WebHTTPBody http_body; | 1201 WebHTTPBody http_body; |
1147 http_body.initialize(); | 1202 http_body.initialize(); |
1148 http_body.appendData(WebData( | 1203 const std::vector<ResourceRequestBody::Element>* uploads = |
1149 reinterpret_cast<const char*>( | 1204 params.browser_initiated_post_data->elements(); |
1150 ¶ms.browser_initiated_post_data.front()), | 1205 std::vector<ResourceRequestBody::Element>::const_iterator iter; |
1151 params.browser_initiated_post_data.size())); | 1206 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { |
| 1207 switch (iter->type()) { |
| 1208 case ResourceRequestBody::Element::TYPE_BYTES: { |
| 1209 http_body.appendData(WebData(iter->bytes(), |
| 1210 static_cast<int>(iter->length()))); |
| 1211 break; |
| 1212 } |
| 1213 case ResourceRequestBody::Element::TYPE_FILE: { |
| 1214 #if defined(OS_POSIX) |
| 1215 WebString filePath = WideToUTF16Hack( |
| 1216 base::SysNativeMBToWide(iter->path().value())); |
| 1217 #elif defined(OS_WIN) |
| 1218 WebString filePath = WideToUTF16Hack(iter->path().value()); |
| 1219 #endif |
| 1220 http_body.appendFileRange( |
| 1221 filePath, |
| 1222 static_cast<long long>(iter->offset()), |
| 1223 static_cast<long long>(iter->length()), |
| 1224 iter->expected_modification_time().ToDoubleT()); |
| 1225 break; |
| 1226 } |
| 1227 case ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM: { |
| 1228 CHECK(false); |
| 1229 break; |
| 1230 } |
| 1231 case ResourceRequestBody::Element:: TYPE_BLOB: { |
| 1232 CHECK(false); |
| 1233 break; |
| 1234 } |
| 1235 default: |
| 1236 NOTREACHED(); |
| 1237 } |
| 1238 } |
1152 request.setHTTPBody(http_body); | 1239 request.setHTTPBody(http_body); |
| 1240 request.setHTTPMethod(WebString::fromUTF8("POST")); |
| 1241 request.setHTTPHeaderField( |
| 1242 WebString::fromUTF8("Content-Type"), |
| 1243 WebString::fromUTF8(params.extra_headers)); |
1153 } | 1244 } |
1154 | |
1155 main_frame->loadRequest(request); | 1245 main_frame->loadRequest(request); |
1156 } | 1246 } |
1157 | |
1158 // In case LoadRequest failed before DidCreateDataSource was called. | 1247 // In case LoadRequest failed before DidCreateDataSource was called. |
1159 pending_navigation_params_.reset(); | 1248 pending_navigation_params_.reset(); |
1160 } | 1249 } |
1161 | 1250 |
1162 bool RenderViewImpl::IsBackForwardToStaleEntry( | 1251 bool RenderViewImpl::IsBackForwardToStaleEntry( |
1163 const ViewMsg_Navigate_Params& params, | 1252 const ViewMsg_Navigate_Params& params, |
1164 bool is_reload) { | 1253 bool is_reload) { |
1165 // Make sure this isn't a back/forward to an entry we have already cropped | 1254 // Make sure this isn't a back/forward to an entry we have already cropped |
1166 // or replaced from our history, before the browser knew about it. If so, | 1255 // or replaced from our history, before the browser knew about it. If so, |
1167 // a new navigation has committed in the mean time, and we can ignore this. | 1256 // 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... |
1655 if (item.urlString() == WebString::fromUTF8(kSwappedOutURL)) | 1744 if (item.urlString() == WebString::fromUTF8(kSwappedOutURL)) |
1656 return; | 1745 return; |
1657 | 1746 |
1658 Send(new ViewHostMsg_UpdateState( | 1747 Send(new ViewHostMsg_UpdateState( |
1659 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 1748 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
1660 } | 1749 } |
1661 | 1750 |
1662 void RenderViewImpl::OpenURL(WebFrame* frame, | 1751 void RenderViewImpl::OpenURL(WebFrame* frame, |
1663 const GURL& url, | 1752 const GURL& url, |
1664 const Referrer& referrer, | 1753 const Referrer& referrer, |
1665 WebNavigationPolicy policy) { | 1754 WebNavigationPolicy policy, |
| 1755 std::string extra_header, |
| 1756 scoped_refptr<ResourceRequestBody> |
| 1757 request_body) { |
1666 ViewHostMsg_OpenURL_Params params; | 1758 ViewHostMsg_OpenURL_Params params; |
1667 params.url = url; | 1759 params.url = url; |
1668 params.referrer = referrer; | 1760 params.referrer = referrer; |
1669 params.disposition = NavigationPolicyToDisposition(policy); | 1761 params.disposition = NavigationPolicyToDisposition(policy); |
1670 params.frame_id = frame->identifier(); | 1762 params.frame_id = frame->identifier(); |
| 1763 params.extra_header = extra_header; |
| 1764 params.request_body = request_body; |
| 1765 |
1671 DocumentState* document_state = | 1766 DocumentState* document_state = |
1672 DocumentState::FromDataSource(frame->dataSource()); | 1767 DocumentState::FromDataSource(frame->dataSource()); |
1673 params.is_cross_site_redirect = | 1768 params.is_cross_site_redirect = |
1674 document_state->navigation_state()->is_redirect_in_progress(); | 1769 document_state->navigation_state()->is_redirect_in_progress(); |
1675 | |
1676 Send(new ViewHostMsg_OpenURL(routing_id_, params)); | 1770 Send(new ViewHostMsg_OpenURL(routing_id_, params)); |
1677 } | 1771 } |
1678 | 1772 |
1679 // WebViewDelegate ------------------------------------------------------------ | 1773 // WebViewDelegate ------------------------------------------------------------ |
1680 | 1774 |
1681 void RenderViewImpl::LoadNavigationErrorPage( | 1775 void RenderViewImpl::LoadNavigationErrorPage( |
1682 WebFrame* frame, | 1776 WebFrame* frame, |
1683 const WebURLRequest& failed_request, | 1777 const WebURLRequest& failed_request, |
1684 const WebURLError& error, | 1778 const WebURLError& error, |
1685 const std::string& html, | 1779 const std::string& html, |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2671 WebFrame* frame, const WebURLRequest& request, | 2765 WebFrame* frame, const WebURLRequest& request, |
2672 WebNavigationPolicy policy, | 2766 WebNavigationPolicy policy, |
2673 const WebString& suggested_name) { | 2767 const WebString& suggested_name) { |
2674 Referrer referrer( | 2768 Referrer referrer( |
2675 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2769 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2676 GetReferrerPolicyFromRequest(frame, request)); | 2770 GetReferrerPolicyFromRequest(frame, request)); |
2677 if (policy == WebKit::WebNavigationPolicyDownload) { | 2771 if (policy == WebKit::WebNavigationPolicyDownload) { |
2678 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2772 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
2679 suggested_name)); | 2773 suggested_name)); |
2680 } else { | 2774 } else { |
2681 OpenURL(frame, request.url(), referrer, policy); | 2775 OpenURL(frame, request.url(), referrer, policy, std::string(), NULL); |
2682 } | 2776 } |
2683 } | 2777 } |
2684 | 2778 |
2685 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 2779 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
2686 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 2780 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
2687 const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { | 2781 const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { |
2688 if (request.url() != GURL(kSwappedOutURL) && | 2782 if (request.url() != GURL(kSwappedOutURL) && |
2689 GetContentClient()->renderer()->HandleNavigation(frame, request, type, | 2783 GetContentClient()->renderer()->HandleNavigation(frame, request, type, |
2690 default_policy, | 2784 default_policy, |
2691 is_redirect)) { | 2785 is_redirect)) { |
2692 return WebKit::WebNavigationPolicyIgnore; | 2786 return WebKit::WebNavigationPolicyIgnore; |
2693 } | 2787 } |
2694 | 2788 |
2695 Referrer referrer( | 2789 Referrer referrer( |
2696 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 2790 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
2697 GetReferrerPolicyFromRequest(frame, request)); | 2791 GetReferrerPolicyFromRequest(frame, request)); |
2698 | 2792 |
| 2793 std::string header; |
| 2794 scoped_refptr<ResourceRequestBody> request_body = |
| 2795 ConstructResourceRequestBody(request); |
| 2796 if (request_body) { |
| 2797 // Extract request header information if request body exist. |
| 2798 WebString ContentType = |
| 2799 request.httpHeaderField(WebString::fromUTF8("Content-Type")); |
| 2800 header.assign(ContentType.utf8().data(), ContentType.utf8().length()); |
| 2801 } |
| 2802 |
2699 if (is_swapped_out_) { | 2803 if (is_swapped_out_) { |
2700 if (request.url() != GURL(kSwappedOutURL)) { | 2804 if (request.url() != GURL(kSwappedOutURL)) { |
2701 // Targeted links may try to navigate a swapped out frame. Allow the | 2805 // Targeted links may try to navigate a swapped out frame. Allow the |
2702 // browser process to navigate the tab instead. Note that it is also | 2806 // browser process to navigate the tab instead. Note that it is also |
2703 // possible for non-targeted navigations (from this view) to arrive | 2807 // possible for non-targeted navigations (from this view) to arrive |
2704 // here just after we are swapped out. It's ok to send them to the | 2808 // here just after we are swapped out. It's ok to send them to the |
2705 // browser, as long as they're for the top level frame. | 2809 // browser, as long as they're for the top level frame. |
2706 // TODO(creis): Ensure this supports targeted form submissions when | 2810 // TODO(creis): Ensure this supports targeted form submissions when |
2707 // fixing http://crbug.com/101395. | 2811 // fixing http://crbug.com/101395. |
2708 if (frame->parent() == NULL) { | 2812 if (frame->parent() == NULL) { |
2709 OpenURL(frame, request.url(), referrer, default_policy); | 2813 OpenURL(frame, request.url(), referrer, |
| 2814 default_policy, header, request_body); |
2710 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2815 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2711 } | 2816 } |
2712 | 2817 |
2713 // We should otherwise ignore in-process iframe navigations, if they | 2818 // We should otherwise ignore in-process iframe navigations, if they |
2714 // arrive just after we are swapped out. | 2819 // arrive just after we are swapped out. |
2715 return WebKit::WebNavigationPolicyIgnore; | 2820 return WebKit::WebNavigationPolicyIgnore; |
2716 } | 2821 } |
2717 | 2822 |
2718 // Allow kSwappedOutURL to complete. | 2823 // Allow kSwappedOutURL to complete. |
2719 return default_policy; | 2824 return default_policy; |
(...skipping 21 matching lines...) Expand all Loading... |
2741 command_line.HasSwitch(switches::kSitePerProcess); | 2846 command_line.HasSwitch(switches::kSitePerProcess); |
2742 if (force_swap_due_to_flag && | 2847 if (force_swap_due_to_flag && |
2743 !frame->parent() && (is_content_initiated || is_redirect)) { | 2848 !frame->parent() && (is_content_initiated || is_redirect)) { |
2744 WebString origin_str = frame->document().securityOrigin().toString(); | 2849 WebString origin_str = frame->document().securityOrigin().toString(); |
2745 GURL frame_url(origin_str.utf8().data()); | 2850 GURL frame_url(origin_str.utf8().data()); |
2746 // TODO(cevans): revisit whether this site check is still necessary once | 2851 // TODO(cevans): revisit whether this site check is still necessary once |
2747 // crbug.com/101395 is fixed. | 2852 // crbug.com/101395 is fixed. |
2748 if (!net::RegistryControlledDomainService::SameDomainOrHost(frame_url, | 2853 if (!net::RegistryControlledDomainService::SameDomainOrHost(frame_url, |
2749 url) || | 2854 url) || |
2750 frame_url.scheme() != url.scheme()) { | 2855 frame_url.scheme() != url.scheme()) { |
2751 OpenURL(frame, url, referrer, default_policy); | 2856 OpenURL(frame, url, referrer, default_policy, header, request_body); |
2752 return WebKit::WebNavigationPolicyIgnore; | 2857 return WebKit::WebNavigationPolicyIgnore; |
2753 } | 2858 } |
2754 } | 2859 } |
2755 | 2860 |
2756 // If the browser is interested, then give it a chance to look at the request. | 2861 // If the browser is interested, then give it a chance to look at the request. |
2757 if (is_content_initiated) { | 2862 if (is_content_initiated) { |
2758 bool browser_handles_request = | 2863 bool browser_handles_request = |
2759 renderer_preferences_.browser_handles_non_local_top_level_requests && | 2864 renderer_preferences_.browser_handles_non_local_top_level_requests && |
2760 IsNonLocalTopLevelNavigation(url, frame, type); | 2865 IsNonLocalTopLevelNavigation(url, frame, type); |
2761 if (!browser_handles_request) { | 2866 if (!browser_handles_request) { |
2762 browser_handles_request = | 2867 browser_handles_request = |
2763 renderer_preferences_.browser_handles_all_top_level_requests && | 2868 renderer_preferences_.browser_handles_all_top_level_requests && |
2764 IsTopLevelNavigation(frame); | 2869 IsTopLevelNavigation(frame); |
2765 } | 2870 } |
2766 | 2871 |
2767 if (browser_handles_request) { | 2872 if (browser_handles_request) { |
2768 // Reset these counters as the RenderView could be reused for the next | 2873 // Reset these counters as the RenderView could be reused for the next |
2769 // navigation. | 2874 // navigation. |
2770 page_id_ = -1; | 2875 page_id_ = -1; |
2771 last_page_id_sent_to_browser_ = -1; | 2876 last_page_id_sent_to_browser_ = -1; |
2772 OpenURL(frame, url, referrer, default_policy); | 2877 OpenURL(frame, url, referrer, default_policy, header, request_body); |
2773 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2878 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2774 } | 2879 } |
2775 } | 2880 } |
2776 | 2881 |
2777 // Use the frame's original request's URL rather than the document's URL for | 2882 // Use the frame's original request's URL rather than the document's URL for |
2778 // subsequent checks. For a popup, the document's URL may become the opener | 2883 // subsequent checks. For a popup, the document's URL may become the opener |
2779 // window's URL if the opener has called document.write(). | 2884 // window's URL if the opener has called document.write(). |
2780 // See http://crbug.com/93517. | 2885 // See http://crbug.com/93517. |
2781 GURL old_url(frame->dataSource()->request().url()); | 2886 GURL old_url(frame->dataSource()->request().url()); |
2782 | 2887 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 if (is_initial_navigation && source_url.is_empty() && frame->opener()) | 2927 if (is_initial_navigation && source_url.is_empty() && frame->opener()) |
2823 source_url = frame->opener()->top()->document().url(); | 2928 source_url = frame->opener()->top()->document().url(); |
2824 DCHECK(!source_url.is_empty()); | 2929 DCHECK(!source_url.is_empty()); |
2825 should_fork = !source_url.SchemeIs(chrome::kFileScheme); | 2930 should_fork = !source_url.SchemeIs(chrome::kFileScheme); |
2826 } | 2931 } |
2827 | 2932 |
2828 if (!should_fork) { | 2933 if (!should_fork) { |
2829 // Give the embedder a chance. | 2934 // Give the embedder a chance. |
2830 // For now, we skip this for POST submissions. This is because | 2935 // For now, we skip this for POST submissions. This is because |
2831 // http://crbug.com/101395 is more likely to cause compatibility issues | 2936 // http://crbug.com/101395 is more likely to cause compatibility issues |
2832 // with hosted apps and extensions than WebUI pages. We will remove this | 2937 // with hosted apps and extensions than WebUI pages. |
2833 // check when cross-process POST submissions are supported. | |
2834 if (request.httpMethod() == "GET") { | |
2835 should_fork = GetContentClient()->renderer()->ShouldFork( | 2938 should_fork = GetContentClient()->renderer()->ShouldFork( |
2836 frame, url, is_initial_navigation, &send_referrer); | 2939 frame, url, is_initial_navigation, &send_referrer); |
2837 } | |
2838 } | 2940 } |
2839 | 2941 |
2840 if (should_fork) { | 2942 if (should_fork) { |
2841 OpenURL( | 2943 OpenURL(frame, url, send_referrer ? referrer : Referrer(), |
2842 frame, url, send_referrer ? referrer : Referrer(), default_policy); | 2944 default_policy, header, request_body); |
2843 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2945 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2844 } | 2946 } |
2845 } | 2947 } |
2846 | 2948 |
2847 // Detect when a page is "forking" a new tab that can be safely rendered in | 2949 // Detect when a page is "forking" a new tab that can be safely rendered in |
2848 // its own process. This is done by sites like Gmail that try to open links | 2950 // its own process. This is done by sites like Gmail that try to open links |
2849 // in new windows without script connections back to the original page. We | 2951 // in new windows without script connections back to the original page. We |
2850 // treat such cases as browser navigations (in which we will create a new | 2952 // treat such cases as browser navigations (in which we will create a new |
2851 // renderer for a cross-site navigation), rather than WebKit navigations. | 2953 // renderer for a cross-site navigation), rather than WebKit navigations. |
2852 // | 2954 // |
(...skipping 18 matching lines...) Expand all Loading... |
2871 frame->parent() == NULL && | 2973 frame->parent() == NULL && |
2872 // Must not have issued the request from this page. | 2974 // Must not have issued the request from this page. |
2873 is_content_initiated && | 2975 is_content_initiated && |
2874 // Must be targeted at the current tab. | 2976 // Must be targeted at the current tab. |
2875 default_policy == WebKit::WebNavigationPolicyCurrentTab && | 2977 default_policy == WebKit::WebNavigationPolicyCurrentTab && |
2876 // Must be a JavaScript navigation, which appears as "other". | 2978 // Must be a JavaScript navigation, which appears as "other". |
2877 type == WebKit::WebNavigationTypeOther; | 2979 type == WebKit::WebNavigationTypeOther; |
2878 | 2980 |
2879 if (is_fork) { | 2981 if (is_fork) { |
2880 // Open the URL via the browser, not via WebKit. | 2982 // Open the URL via the browser, not via WebKit. |
2881 OpenURL(frame, url, Referrer(), default_policy); | 2983 OpenURL(frame, url, Referrer(), default_policy, header, request_body); |
2882 return WebKit::WebNavigationPolicyIgnore; | 2984 return WebKit::WebNavigationPolicyIgnore; |
2883 } | 2985 } |
2884 | 2986 |
2885 return default_policy; | 2987 return default_policy; |
2886 } | 2988 } |
2887 | 2989 |
2888 bool RenderViewImpl::canHandleRequest( | 2990 bool RenderViewImpl::canHandleRequest( |
2889 WebFrame* frame, const WebURLRequest& request) { | 2991 WebFrame* frame, const WebURLRequest& request) { |
2890 // We allow WebKit to think that everything can be handled even though | 2992 // We allow WebKit to think that everything can be handled even though |
2891 // browser-side we limit what we load. | 2993 // browser-side we limit what we load. |
(...skipping 3552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 } | 6546 } |
6445 #endif | 6547 #endif |
6446 | 6548 |
6447 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6549 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6448 TransportDIB::Handle dib_handle) { | 6550 TransportDIB::Handle dib_handle) { |
6449 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6551 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6450 RenderProcess::current()->ReleaseTransportDIB(dib); | 6552 RenderProcess::current()->ReleaseTransportDIB(dib); |
6451 } | 6553 } |
6452 | 6554 |
6453 } // namespace content | 6555 } // namespace content |
OLD | NEW |