Chromium Code Reviews

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2954343005: Merge ResourceRequestBodyImpl and ResourceRequestBody. (Closed)
Patch Set: Remove comment Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "content/browser/appcache/appcache_navigation_handle.h" 11 #include "content/browser/appcache/appcache_navigation_handle.h"
12 #include "content/browser/appcache/appcache_service_impl.h" 12 #include "content/browser/appcache/appcache_service_impl.h"
13 #include "content/browser/child_process_security_policy_impl.h" 13 #include "content/browser/child_process_security_policy_impl.h"
14 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 14 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
15 #include "content/browser/frame_host/ancestor_throttle.h" 15 #include "content/browser/frame_host/ancestor_throttle.h"
16 #include "content/browser/frame_host/data_url_navigation_throttle.h" 16 #include "content/browser/frame_host/data_url_navigation_throttle.h"
17 #include "content/browser/frame_host/debug_urls.h" 17 #include "content/browser/frame_host/debug_urls.h"
18 #include "content/browser/frame_host/form_submission_throttle.h" 18 #include "content/browser/frame_host/form_submission_throttle.h"
19 #include "content/browser/frame_host/frame_tree_node.h" 19 #include "content/browser/frame_host/frame_tree_node.h"
20 #include "content/browser/frame_host/mixed_content_navigation_throttle.h" 20 #include "content/browser/frame_host/mixed_content_navigation_throttle.h"
21 #include "content/browser/frame_host/navigation_controller_impl.h" 21 #include "content/browser/frame_host/navigation_controller_impl.h"
22 #include "content/browser/frame_host/navigation_entry_impl.h" 22 #include "content/browser/frame_host/navigation_entry_impl.h"
23 #include "content/browser/frame_host/navigator.h" 23 #include "content/browser/frame_host/navigator.h"
24 #include "content/browser/frame_host/navigator_delegate.h" 24 #include "content/browser/frame_host/navigator_delegate.h"
25 #include "content/browser/loader/resource_dispatcher_host_impl.h" 25 #include "content/browser/loader/resource_dispatcher_host_impl.h"
26 #include "content/browser/service_worker/service_worker_context_wrapper.h" 26 #include "content/browser/service_worker/service_worker_context_wrapper.h"
27 #include "content/browser/service_worker/service_worker_navigation_handle.h" 27 #include "content/browser/service_worker/service_worker_navigation_handle.h"
28 #include "content/common/child_process_host_impl.h" 28 #include "content/common/child_process_host_impl.h"
29 #include "content/common/frame_messages.h" 29 #include "content/common/frame_messages.h"
30 #include "content/common/resource_request_body_impl.h"
31 #include "content/common/site_isolation_policy.h" 30 #include "content/common/site_isolation_policy.h"
32 #include "content/public/browser/content_browser_client.h" 31 #include "content/public/browser/content_browser_client.h"
33 #include "content/public/browser/navigation_ui_data.h" 32 #include "content/public/browser/navigation_ui_data.h"
34 #include "content/public/browser/site_instance.h" 33 #include "content/public/browser/site_instance.h"
35 #include "content/public/common/browser_side_navigation_policy.h" 34 #include "content/public/common/browser_side_navigation_policy.h"
36 #include "content/public/common/content_client.h" 35 #include "content/public/common/content_client.h"
36 #include "content/public/common/resource_request_body.h"
37 #include "content/public/common/url_constants.h" 37 #include "content/public/common/url_constants.h"
38 #include "net/base/net_errors.h" 38 #include "net/base/net_errors.h"
39 #include "net/url_request/redirect_info.h" 39 #include "net/url_request/redirect_info.h"
40 #include "url/gurl.h" 40 #include "url/gurl.h"
41 #include "url/url_constants.h" 41 #include "url/url_constants.h"
42 42
43 namespace content { 43 namespace content {
44 44
45 namespace { 45 namespace {
46 46
(...skipping 370 matching lines...)
417 417
418 NavigationThrottle::ThrottleCheckResult 418 NavigationThrottle::ThrottleCheckResult
419 NavigationHandleImpl::CallWillStartRequestForTesting( 419 NavigationHandleImpl::CallWillStartRequestForTesting(
420 bool is_post, 420 bool is_post,
421 const Referrer& sanitized_referrer, 421 const Referrer& sanitized_referrer,
422 bool has_user_gesture, 422 bool has_user_gesture,
423 ui::PageTransition transition, 423 ui::PageTransition transition,
424 bool is_external_protocol) { 424 bool is_external_protocol) {
425 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; 425 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
426 426
427 scoped_refptr<ResourceRequestBodyImpl> resource_request_body; 427 scoped_refptr<ResourceRequestBody> resource_request_body;
428 std::string method = "GET"; 428 std::string method = "GET";
429 if (is_post) { 429 if (is_post) {
430 method = "POST"; 430 method = "POST";
431 431
432 std::string body = "test=body"; 432 std::string body = "test=body";
433 resource_request_body = new ResourceRequestBodyImpl(); 433 resource_request_body = new ResourceRequestBody();
434 resource_request_body->AppendBytes(body.data(), body.size()); 434 resource_request_body->AppendBytes(body.data(), body.size());
435 } 435 }
436 436
437 WillStartRequest(method, resource_request_body, sanitized_referrer, 437 WillStartRequest(method, resource_request_body, sanitized_referrer,
438 has_user_gesture, transition, is_external_protocol, 438 has_user_gesture, transition, is_external_protocol,
439 REQUEST_CONTEXT_TYPE_LOCATION, 439 REQUEST_CONTEXT_TYPE_LOCATION,
440 blink::WebMixedContentContextType::kBlockable, 440 blink::WebMixedContentContextType::kBlockable,
441 base::Bind(&UpdateThrottleCheckResult, &result)); 441 base::Bind(&UpdateThrottleCheckResult, &result));
442 442
443 // Reset the callback to ensure it will not be called later. 443 // Reset the callback to ensure it will not be called later.
(...skipping 101 matching lines...)
545 } 545 }
546 546
547 void NavigationHandleImpl::InitAppCacheHandle( 547 void NavigationHandleImpl::InitAppCacheHandle(
548 ChromeAppCacheService* appcache_service) { 548 ChromeAppCacheService* appcache_service) {
549 DCHECK(IsBrowserSideNavigationEnabled()); 549 DCHECK(IsBrowserSideNavigationEnabled());
550 appcache_handle_.reset(new AppCacheNavigationHandle(appcache_service)); 550 appcache_handle_.reset(new AppCacheNavigationHandle(appcache_service));
551 } 551 }
552 552
553 void NavigationHandleImpl::WillStartRequest( 553 void NavigationHandleImpl::WillStartRequest(
554 const std::string& method, 554 const std::string& method,
555 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, 555 scoped_refptr<content::ResourceRequestBody> resource_request_body,
556 const Referrer& sanitized_referrer, 556 const Referrer& sanitized_referrer,
557 bool has_user_gesture, 557 bool has_user_gesture,
558 ui::PageTransition transition, 558 ui::PageTransition transition,
559 bool is_external_protocol, 559 bool is_external_protocol,
560 RequestContextType request_context_type, 560 RequestContextType request_context_type,
561 blink::WebMixedContentContextType mixed_content_context_type, 561 blink::WebMixedContentContextType mixed_content_context_type,
562 const ThrottleChecksFinishedCallback& callback) { 562 const ThrottleChecksFinishedCallback& callback) {
563 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, 563 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this,
564 "WillStartRequest"); 564 "WillStartRequest");
565 if (method != "POST") 565 if (method != "POST")
(...skipping 595 matching lines...)
1161 if (new_site_url == site_url_) 1161 if (new_site_url == site_url_)
1162 return; 1162 return;
1163 1163
1164 // When redirecting cross-site, stop telling the speculative 1164 // When redirecting cross-site, stop telling the speculative
1165 // RenderProcessHost to expect a navigation commit. 1165 // RenderProcessHost to expect a navigation commit.
1166 SetExpectedProcess(nullptr); 1166 SetExpectedProcess(nullptr);
1167 site_url_ = new_site_url; 1167 site_url_ = new_site_url;
1168 } 1168 }
1169 1169
1170 } // namespace content 1170 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.h ('k') | content/browser/frame_host/navigation_request.h » ('j') | no next file with comments »

Powered by Google App Engine