OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "content/browser/appcache/appcache_navigation_handle.h" | 10 #include "content/browser/appcache/appcache_navigation_handle.h" |
11 #include "content/browser/appcache/chrome_appcache_service.h" | 11 #include "content/browser/appcache/chrome_appcache_service.h" |
12 #include "content/browser/child_process_security_policy_impl.h" | 12 #include "content/browser/child_process_security_policy_impl.h" |
13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
14 #include "content/browser/frame_host/debug_urls.h" | 14 #include "content/browser/frame_host/debug_urls.h" |
15 #include "content/browser/frame_host/frame_tree.h" | 15 #include "content/browser/frame_host/frame_tree.h" |
16 #include "content/browser/frame_host/frame_tree_node.h" | 16 #include "content/browser/frame_host/frame_tree_node.h" |
17 #include "content/browser/frame_host/navigation_controller_impl.h" | 17 #include "content/browser/frame_host/navigation_controller_impl.h" |
18 #include "content/browser/frame_host/navigation_handle_impl.h" | 18 #include "content/browser/frame_host/navigation_handle_impl.h" |
19 #include "content/browser/frame_host/navigation_request_info.h" | 19 #include "content/browser/frame_host/navigation_request_info.h" |
20 #include "content/browser/frame_host/navigator.h" | 20 #include "content/browser/frame_host/navigator.h" |
21 #include "content/browser/frame_host/navigator_impl.h" | 21 #include "content/browser/frame_host/navigator_impl.h" |
| 22 #include "content/browser/frame_host/render_frame_host_impl.h" |
22 #include "content/browser/loader/navigation_url_loader.h" | 23 #include "content/browser/loader/navigation_url_loader.h" |
23 #include "content/browser/renderer_host/render_process_host_impl.h" | 24 #include "content/browser/renderer_host/render_process_host_impl.h" |
24 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 25 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
25 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 26 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
26 #include "content/browser/site_instance_impl.h" | 27 #include "content/browser/site_instance_impl.h" |
27 #include "content/common/appcache_interfaces.h" | 28 #include "content/common/appcache_interfaces.h" |
28 #include "content/common/resource_request_body_impl.h" | 29 #include "content/common/resource_request_body_impl.h" |
29 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
30 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
31 #include "content/public/browser/global_request_id.h" | 32 #include "content/public/browser/global_request_id.h" |
32 #include "content/public/browser/navigation_controller.h" | 33 #include "content/public/browser/navigation_controller.h" |
33 #include "content/public/browser/navigation_data.h" | 34 #include "content/public/browser/navigation_data.h" |
34 #include "content/public/browser/navigation_ui_data.h" | 35 #include "content/public/browser/navigation_ui_data.h" |
| 36 #include "content/public/browser/render_view_host.h" |
35 #include "content/public/browser/storage_partition.h" | 37 #include "content/public/browser/storage_partition.h" |
36 #include "content/public/browser/stream_handle.h" | 38 #include "content/public/browser/stream_handle.h" |
37 #include "content/public/common/appcache_info.h" | 39 #include "content/public/common/appcache_info.h" |
38 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
39 #include "content/public/common/origin_util.h" | 41 #include "content/public/common/origin_util.h" |
40 #include "content/public/common/request_context_type.h" | 42 #include "content/public/common/request_context_type.h" |
41 #include "content/public/common/resource_response.h" | 43 #include "content/public/common/resource_response.h" |
42 #include "content/public/common/url_constants.h" | 44 #include "content/public/common/url_constants.h" |
| 45 #include "content/public/common/web_preferences.h" |
43 #include "net/base/load_flags.h" | 46 #include "net/base/load_flags.h" |
44 #include "net/base/net_errors.h" | 47 #include "net/base/net_errors.h" |
45 #include "net/base/url_util.h" | 48 #include "net/base/url_util.h" |
46 #include "net/http/http_request_headers.h" | 49 #include "net/http/http_request_headers.h" |
47 #include "net/url_request/redirect_info.h" | 50 #include "net/url_request/redirect_info.h" |
48 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" | 51 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" |
49 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 52 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
50 | 53 |
51 namespace content { | 54 namespace content { |
52 | 55 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; | 657 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; |
655 request_params_.should_create_service_worker = can_create_service_worker; | 658 request_params_.should_create_service_worker = can_create_service_worker; |
656 if (can_create_service_worker) { | 659 if (can_create_service_worker) { |
657 ServiceWorkerContextWrapper* service_worker_context = | 660 ServiceWorkerContextWrapper* service_worker_context = |
658 static_cast<ServiceWorkerContextWrapper*>( | 661 static_cast<ServiceWorkerContextWrapper*>( |
659 partition->GetServiceWorkerContext()); | 662 partition->GetServiceWorkerContext()); |
660 navigation_handle_->InitServiceWorkerHandle(service_worker_context); | 663 navigation_handle_->InitServiceWorkerHandle(service_worker_context); |
661 } | 664 } |
662 | 665 |
663 if (IsSchemeSupportedForAppCache(common_params_.url)) { | 666 if (IsSchemeSupportedForAppCache(common_params_.url)) { |
664 navigation_handle_->InitAppCacheHandle( | 667 RenderFrameHostImpl* render_frame_host = |
665 static_cast<ChromeAppCacheService*>(partition->GetAppCacheService())); | 668 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
| 669 if (render_frame_host->GetRenderViewHost() |
| 670 ->GetWebkitPreferences() |
| 671 .application_cache_enabled) { |
| 672 navigation_handle_->InitAppCacheHandle( |
| 673 static_cast<ChromeAppCacheService*>(partition->GetAppCacheService())); |
| 674 } |
666 } | 675 } |
667 | 676 |
668 // Mark the fetch_start (Navigation Timing API). | 677 // Mark the fetch_start (Navigation Timing API). |
669 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); | 678 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); |
670 | 679 |
671 // TODO(mkwst): This is incorrect. It ought to use the definition from | 680 // TODO(mkwst): This is incorrect. It ought to use the definition from |
672 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree | 681 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree |
673 // and verifies that all origins are PSL-matches (and special-cases extension | 682 // and verifies that all origins are PSL-matches (and special-cases extension |
674 // URLs). | 683 // URLs). |
675 const GURL& first_party_for_cookies = | 684 const GURL& first_party_for_cookies = |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 783 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
775 | 784 |
776 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 785 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
777 common_params_, request_params_, | 786 common_params_, request_params_, |
778 is_view_source_); | 787 is_view_source_); |
779 | 788 |
780 frame_tree_node_->ResetNavigationRequest(true); | 789 frame_tree_node_->ResetNavigationRequest(true); |
781 } | 790 } |
782 | 791 |
783 } // namespace content | 792 } // namespace content |
OLD | NEW |