| 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 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
| 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and | 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and |
| 7 // dispatches them to URLRequests. It then forwards the messages from the | 7 // dispatches them to URLRequests. It then forwards the messages from the |
| 8 // URLRequests back to the correct process for handling. | 8 // URLRequests back to the correct process for handling. |
| 9 // | 9 // |
| 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 static void ResumeBlockedRequestsForFrameFromUI( | 121 static void ResumeBlockedRequestsForFrameFromUI( |
| 122 RenderFrameHost* root_frame_host); | 122 RenderFrameHost* root_frame_host); |
| 123 | 123 |
| 124 // Cancels any blocked request for the frame and its subframes. | 124 // Cancels any blocked request for the frame and its subframes. |
| 125 static void CancelBlockedRequestsForFrameFromUI( | 125 static void CancelBlockedRequestsForFrameFromUI( |
| 126 RenderFrameHostImpl* root_frame_host); | 126 RenderFrameHostImpl* root_frame_host); |
| 127 | 127 |
| 128 // ResourceDispatcherHost implementation: | 128 // ResourceDispatcherHost implementation: |
| 129 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; | 129 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; |
| 130 void SetAllowCrossOriginAuthPrompt(bool value) override; | 130 void SetAllowCrossOriginAuthPrompt(bool value) override; |
| 131 DownloadInterruptReason BeginDownload( | |
| 132 scoped_ptr<net::URLRequest> request, | |
| 133 const Referrer& referrer, | |
| 134 bool is_content_initiated, | |
| 135 ResourceContext* context, | |
| 136 int child_id, | |
| 137 int render_view_route_id, | |
| 138 int render_frame_route_id, | |
| 139 bool prefer_cache, | |
| 140 bool do_not_prompt_for_login, | |
| 141 scoped_ptr<DownloadSaveInfo> save_info, | |
| 142 uint32_t download_id, | |
| 143 const DownloadStartedCallback& started_callback) override; | |
| 144 void ClearLoginDelegateForRequest(net::URLRequest* request) override; | 131 void ClearLoginDelegateForRequest(net::URLRequest* request) override; |
| 145 | 132 |
| 146 // Puts the resource dispatcher host in an inactive state (unable to begin | 133 // Puts the resource dispatcher host in an inactive state (unable to begin |
| 147 // new requests). Cancels all pending requests. | 134 // new requests). Cancels all pending requests. |
| 148 void Shutdown(); | 135 void Shutdown(); |
| 149 | 136 |
| 150 // Notify the ResourceDispatcherHostImpl of a new resource context. | 137 // Notify the ResourceDispatcherHostImpl of a new resource context. |
| 151 void AddResourceContext(ResourceContext* context); | 138 void AddResourceContext(ResourceContext* context); |
| 152 | 139 |
| 153 // Notify the ResourceDispatcherHostImpl of a resource context destruction. | 140 // Notify the ResourceDispatcherHostImpl of a resource context destruction. |
| 154 void RemoveResourceContext(ResourceContext* context); | 141 void RemoveResourceContext(ResourceContext* context); |
| 155 | 142 |
| 156 // Force cancels any pending requests for the given |context|. This is | 143 // Force cancels any pending requests for the given |context|. This is |
| 157 // necessary to ensure that before |context| goes away, all requests | 144 // necessary to ensure that before |context| goes away, all requests |
| 158 // for it are dead. | 145 // for it are dead. |
| 159 void CancelRequestsForContext(ResourceContext* context); | 146 void CancelRequestsForContext(ResourceContext* context); |
| 160 | 147 |
| 161 // Returns true if the message was a resource message that was processed. | 148 // Returns true if the message was a resource message that was processed. |
| 162 bool OnMessageReceived(const IPC::Message& message, | 149 bool OnMessageReceived(const IPC::Message& message, |
| 163 ResourceMessageFilter* filter); | 150 ResourceMessageFilter* filter); |
| 164 | 151 |
| 152 DownloadInterruptReason BeginDownload(scoped_ptr<net::URLRequest> request, |
| 153 const Referrer& referrer, |
| 154 bool is_content_initiated, |
| 155 ResourceContext* context, |
| 156 int child_id, |
| 157 int render_view_route_id, |
| 158 int render_frame_route_id, |
| 159 bool do_not_prompt_for_login); |
| 160 |
| 165 // Initiates a save file from the browser process (as opposed to a resource | 161 // Initiates a save file from the browser process (as opposed to a resource |
| 166 // request from the renderer or another child process). | 162 // request from the renderer or another child process). |
| 167 void BeginSaveFile(const GURL& url, | 163 void BeginSaveFile(const GURL& url, |
| 168 const Referrer& referrer, | 164 const Referrer& referrer, |
| 169 SaveItemId save_item_id, | 165 SaveItemId save_item_id, |
| 170 SavePackageId save_package_id, | 166 SavePackageId save_package_id, |
| 171 int child_id, | 167 int child_id, |
| 172 int render_view_route_id, | 168 int render_view_route_id, |
| 173 int render_frame_route_id, | 169 int render_frame_route_id, |
| 174 ResourceContext* context); | 170 ResourceContext* context); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return delegate_; | 261 return delegate_; |
| 266 } | 262 } |
| 267 | 263 |
| 268 // Must be called after the ResourceRequestInfo has been created | 264 // Must be called after the ResourceRequestInfo has been created |
| 269 // and associated with the request. | 265 // and associated with the request. |
| 270 // |id| should be |content::DownloadItem::kInvalidId| to request automatic | 266 // |id| should be |content::DownloadItem::kInvalidId| to request automatic |
| 271 // assignment. This is marked virtual so it can be overriden in testing. | 267 // assignment. This is marked virtual so it can be overriden in testing. |
| 272 virtual scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 268 virtual scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
| 273 net::URLRequest* request, | 269 net::URLRequest* request, |
| 274 bool is_content_initiated, | 270 bool is_content_initiated, |
| 275 bool must_download, | 271 bool must_download); |
| 276 uint32_t id, | |
| 277 scoped_ptr<DownloadSaveInfo> save_info, | |
| 278 const DownloadUrlParameters::OnStartedCallback& started_cb); | |
| 279 | 272 |
| 280 // Called to determine whether the response to |request| should be intercepted | 273 // Called to determine whether the response to |request| should be intercepted |
| 281 // and handled as a stream. Streams are used to pass direct access to a | 274 // and handled as a stream. Streams are used to pass direct access to a |
| 282 // resource response to another application (e.g. a web page) without being | 275 // resource response to another application (e.g. a web page) without being |
| 283 // handled by the browser itself. If the request should be intercepted as a | 276 // handled by the browser itself. If the request should be intercepted as a |
| 284 // stream, a StreamResourceHandler is returned which provides access to the | 277 // stream, a StreamResourceHandler is returned which provides access to the |
| 285 // response. |plugin_path| is the path to the plugin which is handling the | 278 // response. |plugin_path| is the path to the plugin which is handling the |
| 286 // URL request. This may be empty if there is no plugin handling the request. | 279 // URL request. This may be empty if there is no plugin handling the request. |
| 287 // | 280 // |
| 288 // This function must be called after the ResourceRequestInfo has been created | 281 // This function must be called after the ResourceRequestInfo has been created |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 DelegateMap delegate_map_; | 641 DelegateMap delegate_map_; |
| 649 | 642 |
| 650 scoped_ptr<ResourceScheduler> scheduler_; | 643 scoped_ptr<ResourceScheduler> scheduler_; |
| 651 | 644 |
| 652 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 645 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 653 }; | 646 }; |
| 654 | 647 |
| 655 } // namespace content | 648 } // namespace content |
| 656 | 649 |
| 657 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 650 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |