Index: content/browser/loader/resource_dispatcher_host_impl.h |
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h |
index 577502e169eddf705776b3f9f1dce51fc50a14a2..8ce2dd0521ba38ae63cbeef1650b671b8d83b627 100644 |
--- a/content/browser/loader/resource_dispatcher_host_impl.h |
+++ b/content/browser/loader/resource_dispatcher_host_impl.h |
@@ -24,7 +24,6 @@ |
#include "base/observer_list.h" |
#include "base/time/time.h" |
#include "base/timer/timer.h" |
-#include "content/browser/download/download_resource_handler.h" |
#include "content/browser/download/save_types.h" |
#include "content/browser/loader/global_routing_id.h" |
#include "content/browser/loader/resource_loader.h" |
@@ -65,12 +64,12 @@ class NavigationURLLoaderImplCore; |
class RenderFrameHostImpl; |
class ResourceContext; |
class ResourceDispatcherHostDelegate; |
+class ResourceHandler; |
class ResourceMessageDelegate; |
class ResourceMessageFilter; |
class ResourceRequestInfoImpl; |
class ServiceWorkerNavigationHandleCore; |
struct CommonNavigationParams; |
-struct DownloadSaveInfo; |
struct NavigationRequestInfo; |
struct Referrer; |
struct ResourceRequest; |
@@ -79,6 +78,10 @@ namespace mojom { |
class URLLoader; |
} // namespace mojom |
+typedef base::Callback< |
+ std::unique_ptr<ResourceHandler>(net::URLRequest*, bool, bool)> |
+ CreateDownloadHandlerIntercept; |
Randy Smith (Not in Mondays)
2016/08/17 15:53:54
nit: I think "using X = " is the new hotness?
ananta
2016/08/18 01:53:25
Done.
|
+ |
class CONTENT_EXPORT ResourceDispatcherHostImpl |
: public ResourceDispatcherHost, |
public ResourceLoaderDelegate { |
@@ -129,27 +132,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
bool OnMessageReceived(const IPC::Message& message, |
ResourceMessageFilter* filter); |
- DownloadInterruptReason BeginDownload( |
- std::unique_ptr<net::URLRequest> request, |
- const Referrer& referrer, |
- bool is_content_initiated, |
- ResourceContext* context, |
- int render_process_id, |
- int render_view_route_id, |
- int render_frame_route_id, |
- bool do_not_prompt_for_login); |
- |
- // Initiates a save file from the browser process (as opposed to a resource |
- // request from the renderer or another child process). |
- void BeginSaveFile(const GURL& url, |
- const Referrer& referrer, |
- SaveItemId save_item_id, |
- SavePackageId save_package_id, |
- int child_id, |
- int render_view_route_id, |
- int render_frame_route_id, |
- ResourceContext* context); |
- |
// Cancels the given request if it still exists. |
void CancelRequest(int child_id, int request_id); |
@@ -309,6 +291,26 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
mojom::URLLoaderClientPtr url_loader_client, |
ResourceMessageFilter* filter); |
+ // Helper function for regular and download requests. |
+ void BeginURLRequest(std::unique_ptr<net::URLRequest> request, |
+ std::unique_ptr<ResourceHandler> handler); |
+ |
+ // Creates and returns a ResourceRequestInfoImpl instance. |
+ ResourceRequestInfoImpl* CreateRequestInfo(int child_id, |
+ int render_view_route_id, |
+ int render_frame_route_id, |
+ bool download, |
+ ResourceContext* context); |
+ |
+ bool is_shutdown() const { return is_shutdown_; } |
+ |
+ // Registers the |intercept| as the callback to be invoked when the download |
+ // handler is created for handling downloads. |
+ // TODO(ananta) |
+ // Investigate if we can find a better way to do this. |
+ void RegisterCreateDownloadHandlerInterceptor( |
+ CreateDownloadHandlerIntercept intercept); |
+ |
private: |
friend class ResourceDispatcherHostTest; |
@@ -378,10 +380,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
// A shutdown helper that runs on the IO thread. |
void OnShutdown(); |
- // Helper function for regular and download requests. |
- void BeginRequestInternal(std::unique_ptr<net::URLRequest> request, |
- std::unique_ptr<ResourceHandler> handler); |
- |
void StartLoading(ResourceRequestInfoImpl* info, |
std::unique_ptr<ResourceLoader> loader); |
@@ -552,15 +550,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
net::RequestPriority new_priority, |
int intra_priority_value); |
- // Creates ResourceRequestInfoImpl for a download or page save. |
- // |download| should be true if the request is a file download. |
- ResourceRequestInfoImpl* CreateRequestInfo( |
- int child_id, |
- int render_view_route_id, |
- int render_frame_route_id, |
- bool download, |
- ResourceContext* context); |
- |
// Relationship of resource being authenticated with the top level page. |
enum HttpAuthRelationType { |
HTTP_AUTH_RELATION_TOP, // Top-level page itself |
@@ -709,6 +698,9 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
// Used to invoke an interceptor for the HTTP header. |
HeaderInterceptorMap http_header_interceptor_map_; |
+ // Points to the registered download handler intercept. |
+ CreateDownloadHandlerIntercept create_download_handler_intercept_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
}; |