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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2335133003: PlzNavigate: support the WebRequest API (Closed)
Patch Set: Rebase + addressed nit Created 4 years, 2 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
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "content/common/navigation_params.h" 70 #include "content/common/navigation_params.h"
71 #include "content/common/net/url_request_service_worker_data.h" 71 #include "content/common/net/url_request_service_worker_data.h"
72 #include "content/common/resource_messages.h" 72 #include "content/common/resource_messages.h"
73 #include "content/common/resource_request.h" 73 #include "content/common/resource_request.h"
74 #include "content/common/resource_request_body_impl.h" 74 #include "content/common/resource_request_body_impl.h"
75 #include "content/common/resource_request_completion_status.h" 75 #include "content/common/resource_request_completion_status.h"
76 #include "content/common/site_isolation_policy.h" 76 #include "content/common/site_isolation_policy.h"
77 #include "content/common/view_messages.h" 77 #include "content/common/view_messages.h"
78 #include "content/public/browser/browser_thread.h" 78 #include "content/public/browser/browser_thread.h"
79 #include "content/public/browser/global_request_id.h" 79 #include "content/public/browser/global_request_id.h"
80 #include "content/public/browser/navigation_ui_data.h"
80 #include "content/public/browser/plugin_service.h" 81 #include "content/public/browser/plugin_service.h"
81 #include "content/public/browser/resource_dispatcher_host_delegate.h" 82 #include "content/public/browser/resource_dispatcher_host_delegate.h"
82 #include "content/public/browser/resource_request_details.h" 83 #include "content/public/browser/resource_request_details.h"
83 #include "content/public/browser/resource_throttle.h" 84 #include "content/public/browser/resource_throttle.h"
84 #include "content/public/browser/stream_handle.h" 85 #include "content/public/browser/stream_handle.h"
85 #include "content/public/browser/stream_info.h" 86 #include "content/public/browser/stream_info.h"
86 #include "content/public/common/browser_side_navigation_policy.h" 87 #include "content/public/common/browser_side_navigation_policy.h"
87 #include "content/public/common/content_features.h" 88 #include "content/public/common/content_features.h"
88 #include "content/public/common/content_switches.h" 89 #include "content/public/common/content_switches.h"
89 #include "content/public/common/process_type.h" 90 #include "content/public/common/process_type.h"
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2040
2040 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( 2041 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest(
2041 net::URLRequest* request) { 2042 net::URLRequest* request) {
2042 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); 2043 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
2043 IncrementOutstandingRequestsCount(-1, info); 2044 IncrementOutstandingRequestsCount(-1, info);
2044 } 2045 }
2045 2046
2046 void ResourceDispatcherHostImpl::BeginNavigationRequest( 2047 void ResourceDispatcherHostImpl::BeginNavigationRequest(
2047 ResourceContext* resource_context, 2048 ResourceContext* resource_context,
2048 const NavigationRequestInfo& info, 2049 const NavigationRequestInfo& info,
2050 std::unique_ptr<NavigationUIData> navigation_ui_data,
2049 NavigationURLLoaderImplCore* loader, 2051 NavigationURLLoaderImplCore* loader,
2050 ServiceWorkerNavigationHandleCore* service_worker_handle_core) { 2052 ServiceWorkerNavigationHandleCore* service_worker_handle_core) {
2051 // PlzNavigate: BeginNavigationRequest currently should only be used for the 2053 // PlzNavigate: BeginNavigationRequest currently should only be used for the
2052 // browser-side navigations project. 2054 // browser-side navigations project.
2053 CHECK(IsBrowserSideNavigationEnabled()); 2055 CHECK(IsBrowserSideNavigationEnabled());
2054 2056
2055 ResourceType resource_type = info.is_main_frame ? 2057 ResourceType resource_type = info.is_main_frame ?
2056 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; 2058 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME;
2057 2059
2058 if (is_shutdown_ || 2060 if (is_shutdown_ ||
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 // here. 2162 // here.
2161 // TODO(ricea): Make the feature work with stale-while-revalidate 2163 // TODO(ricea): Make the feature work with stale-while-revalidate
2162 // and clean this up. 2164 // and clean this up.
2163 std::string(), // original_headers 2165 std::string(), // original_headers
2164 info.common_params.post_data, 2166 info.common_params.post_data,
2165 // TODO(mek): Currently initiated_in_secure_context is only used for 2167 // TODO(mek): Currently initiated_in_secure_context is only used for
2166 // subresource requests, so it doesn't matter what value it gets here. 2168 // subresource requests, so it doesn't matter what value it gets here.
2167 // If in the future this changes this should be updated to somehow get a 2169 // If in the future this changes this should be updated to somehow get a
2168 // meaningful value. 2170 // meaningful value.
2169 false); // initiated_in_secure_context 2171 false); // initiated_in_secure_context
2172 extra_info->set_navigation_ui_data(std::move(navigation_ui_data));
2173
2170 // Request takes ownership. 2174 // Request takes ownership.
2171 extra_info->AssociateWithRequest(new_request.get()); 2175 extra_info->AssociateWithRequest(new_request.get());
2172 2176
2173 if (new_request->url().SchemeIs(url::kBlobScheme)) { 2177 if (new_request->url().SchemeIs(url::kBlobScheme)) {
2174 // Hang on to a reference to ensure the blob is not released prior 2178 // Hang on to a reference to ensure the blob is not released prior
2175 // to the job being started. 2179 // to the job being started.
2176 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 2180 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
2177 new_request.get(), 2181 new_request.get(),
2178 blob_context->GetBlobDataFromPublicURL(new_request->url())); 2182 blob_context->GetBlobDataFromPublicURL(new_request->url()));
2179 } 2183 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 2368
2365 void ResourceDispatcherHostImpl::StartLoading( 2369 void ResourceDispatcherHostImpl::StartLoading(
2366 ResourceRequestInfoImpl* info, 2370 ResourceRequestInfoImpl* info,
2367 std::unique_ptr<ResourceLoader> loader) { 2371 std::unique_ptr<ResourceLoader> loader) {
2368 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed. 2372 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed.
2369 tracked_objects::ScopedTracker tracking_profile( 2373 tracked_objects::ScopedTracker tracking_profile(
2370 FROM_HERE_WITH_EXPLICIT_FUNCTION( 2374 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2371 "456331 ResourceDispatcherHostImpl::StartLoading")); 2375 "456331 ResourceDispatcherHostImpl::StartLoading"));
2372 2376
2373 ResourceLoader* loader_ptr = loader.get(); 2377 ResourceLoader* loader_ptr = loader.get();
2378 DCHECK(pending_loaders_[info->GetGlobalRequestID()] == nullptr);
2374 pending_loaders_[info->GetGlobalRequestID()] = std::move(loader); 2379 pending_loaders_[info->GetGlobalRequestID()] = std::move(loader);
2375 2380
2376 loader_ptr->StartRequest(); 2381 loader_ptr->StartRequest();
2377 } 2382 }
2378 2383
2379 void ResourceDispatcherHostImpl::OnUserGesture() { 2384 void ResourceDispatcherHostImpl::OnUserGesture() {
2380 last_user_gesture_time_ = TimeTicks::Now(); 2385 last_user_gesture_time_ = TimeTicks::Now();
2381 } 2386 }
2382 2387
2383 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( 2388 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest(
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 &throttles); 2703 &throttles);
2699 if (!throttles.empty()) { 2704 if (!throttles.empty()) {
2700 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2705 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2701 std::move(throttles))); 2706 std::move(throttles)));
2702 } 2707 }
2703 } 2708 }
2704 return handler; 2709 return handler;
2705 } 2710 }
2706 2711
2707 } // namespace content 2712 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698