| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 28 matching lines...) Expand all Loading... |
| 39 class ResourceMessageFilter; | 39 class ResourceMessageFilter; |
| 40 class SafeBrowsingService; | 40 class SafeBrowsingService; |
| 41 class SaveFileManager; | 41 class SaveFileManager; |
| 42 class SSLClientAuthHandler; | 42 class SSLClientAuthHandler; |
| 43 class WebKitThread; | 43 class WebKitThread; |
| 44 struct DownloadSaveInfo; | 44 struct DownloadSaveInfo; |
| 45 struct GlobalRequestID; | 45 struct GlobalRequestID; |
| 46 struct ResourceHostMsg_Request; | 46 struct ResourceHostMsg_Request; |
| 47 struct ViewMsg_ClosePage_Params; | 47 struct ViewMsg_ClosePage_Params; |
| 48 | 48 |
| 49 namespace net { | 49 namespace content { |
| 50 class URLRequestContext; | 50 class ResourceContext; |
| 51 } // namespace net | 51 } |
| 52 | 52 |
| 53 namespace webkit_blob { | 53 namespace webkit_blob { |
| 54 class DeletableFileReference; | 54 class DeletableFileReference; |
| 55 } | 55 } |
| 56 | 56 |
| 57 class ResourceDispatcherHost : public net::URLRequest::Delegate { | 57 class ResourceDispatcherHost : public net::URLRequest::Delegate { |
| 58 public: | 58 public: |
| 59 explicit ResourceDispatcherHost( | 59 explicit ResourceDispatcherHost( |
| 60 const ResourceQueue::DelegateSet& resource_queue_delegates); | 60 const ResourceQueue::DelegateSet& resource_queue_delegates); |
| 61 ~ResourceDispatcherHost(); | 61 ~ResourceDispatcherHost(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 bool* message_was_ok); | 73 bool* message_was_ok); |
| 74 | 74 |
| 75 // Initiates a download from the browser process (as opposed to a resource | 75 // Initiates a download from the browser process (as opposed to a resource |
| 76 // request from the renderer or another child process). | 76 // request from the renderer or another child process). |
| 77 void BeginDownload(const GURL& url, | 77 void BeginDownload(const GURL& url, |
| 78 const GURL& referrer, | 78 const GURL& referrer, |
| 79 const DownloadSaveInfo& save_info, | 79 const DownloadSaveInfo& save_info, |
| 80 bool prompt_for_save_location, | 80 bool prompt_for_save_location, |
| 81 int process_unique_id, | 81 int process_unique_id, |
| 82 int route_id, | 82 int route_id, |
| 83 net::URLRequestContext* request_context); | 83 const content::ResourceContext& context); |
| 84 | 84 |
| 85 // Initiates a save file from the browser process (as opposed to a resource | 85 // Initiates a save file from the browser process (as opposed to a resource |
| 86 // request from the renderer or another child process). | 86 // request from the renderer or another child process). |
| 87 void BeginSaveFile(const GURL& url, | 87 void BeginSaveFile(const GURL& url, |
| 88 const GURL& referrer, | 88 const GURL& referrer, |
| 89 int process_unique_id, | 89 int process_unique_id, |
| 90 int route_id, | 90 int route_id, |
| 91 net::URLRequestContext* request_context); | 91 const content::ResourceContext& context); |
| 92 | 92 |
| 93 // Cancels the given request if it still exists. We ignore cancels from the | 93 // Cancels the given request if it still exists. We ignore cancels from the |
| 94 // renderer in the event of a download. | 94 // renderer in the event of a download. |
| 95 void CancelRequest(int process_unique_id, | 95 void CancelRequest(int process_unique_id, |
| 96 int request_id, | 96 int request_id, |
| 97 bool from_renderer); | 97 bool from_renderer); |
| 98 | 98 |
| 99 // Follows a deferred redirect for the given request. | 99 // Follows a deferred redirect for the given request. |
| 100 // new_first_party_for_cookies, if non-empty, is the new cookie policy URL | 100 // new_first_party_for_cookies, if non-empty, is the new cookie policy URL |
| 101 // for the redirected URL. If the cookie policy URL needs changing, pass | 101 // for the redirected URL. If the cookie policy URL needs changing, pass |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 const GURL& new_url, | 172 const GURL& new_url, |
| 173 bool* defer_redirect); | 173 bool* defer_redirect); |
| 174 virtual void OnAuthRequired(net::URLRequest* request, | 174 virtual void OnAuthRequired(net::URLRequest* request, |
| 175 net::AuthChallengeInfo* auth_info); | 175 net::AuthChallengeInfo* auth_info); |
| 176 virtual void OnCertificateRequested( | 176 virtual void OnCertificateRequested( |
| 177 net::URLRequest* request, | 177 net::URLRequest* request, |
| 178 net::SSLCertRequestInfo* cert_request_info); | 178 net::SSLCertRequestInfo* cert_request_info); |
| 179 virtual void OnSSLCertificateError(net::URLRequest* request, | 179 virtual void OnSSLCertificateError(net::URLRequest* request, |
| 180 int cert_error, | 180 int cert_error, |
| 181 net::X509Certificate* cert); | 181 net::X509Certificate* cert); |
| 182 virtual void OnGetCookies(net::URLRequest* request, | 182 virtual bool CanGetCookies(net::URLRequest* request); |
| 183 bool blocked_by_policy); | 183 virtual bool CanSetCookie(net::URLRequest* request, |
| 184 virtual void OnSetCookie(net::URLRequest* request, | 184 const std::string& cookie_line, |
| 185 const std::string& cookie_line, | 185 net::CookieOptions* options); |
| 186 const net::CookieOptions& options, | |
| 187 bool blocked_by_policy); | |
| 188 virtual void OnResponseStarted(net::URLRequest* request); | 186 virtual void OnResponseStarted(net::URLRequest* request); |
| 189 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); | 187 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); |
| 190 void OnResponseCompleted(net::URLRequest* request); | 188 void OnResponseCompleted(net::URLRequest* request); |
| 191 | 189 |
| 192 // Helper functions to get our extra data out of a request. The given request | 190 // Helper functions to get our extra data out of a request. The given request |
| 193 // must have been one we created so that it has the proper extra data pointer. | 191 // must have been one we created so that it has the proper extra data pointer. |
| 194 static ResourceDispatcherHostRequestInfo* InfoForRequest( | 192 static ResourceDispatcherHostRequestInfo* InfoForRequest( |
| 195 net::URLRequest* request); | 193 net::URLRequest* request); |
| 196 static const ResourceDispatcherHostRequestInfo* InfoForRequest( | 194 static const ResourceDispatcherHostRequestInfo* InfoForRequest( |
| 197 const net::URLRequest* request); | 195 const net::URLRequest* request); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 bool IsPrerenderingChildRoutePair(int child_id, int route_id) const; | 383 bool IsPrerenderingChildRoutePair(int child_id, int route_id) const; |
| 386 | 384 |
| 387 ResourceHandler* CreateSafeBrowsingResourceHandler( | 385 ResourceHandler* CreateSafeBrowsingResourceHandler( |
| 388 ResourceHandler* handler, int child_id, int route_id, | 386 ResourceHandler* handler, int child_id, int route_id, |
| 389 ResourceType::Type resource_type); | 387 ResourceType::Type resource_type); |
| 390 | 388 |
| 391 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request | 389 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request |
| 392 // (a download or a page save). |download| should be true if the request | 390 // (a download or a page save). |download| should be true if the request |
| 393 // is a file download. | 391 // is a file download. |
| 394 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( | 392 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( |
| 395 ResourceHandler* handler, int child_id, int route_id, bool download); | 393 ResourceHandler* handler, |
| 394 int child_id, |
| 395 int route_id, |
| 396 bool download, |
| 397 const content::ResourceContext& context); |
| 396 | 398 |
| 397 // Returns true if |request| is in |pending_requests_|. | 399 // Returns true if |request| is in |pending_requests_|. |
| 398 bool IsValidRequest(net::URLRequest* request); | 400 bool IsValidRequest(net::URLRequest* request); |
| 399 | 401 |
| 400 // Determine request priority based on how critical this resource typically | 402 // Determine request priority based on how critical this resource typically |
| 401 // is to user-perceived page load performance. | 403 // is to user-perceived page load performance. |
| 402 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type, | 404 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type, |
| 403 int load_flags); | 405 int load_flags); |
| 404 | 406 |
| 405 // Sends the given notification on the UI thread. The RenderViewHost's | 407 // Sends the given notification on the UI thread. The RenderViewHost's |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 ResourceMessageFilter* filter_; | 483 ResourceMessageFilter* filter_; |
| 482 | 484 |
| 483 static bool is_prefetch_enabled_; | 485 static bool is_prefetch_enabled_; |
| 484 PrerenderChildRouteIdPairs prerender_child_route_pairs_; | 486 PrerenderChildRouteIdPairs prerender_child_route_pairs_; |
| 485 | 487 |
| 486 | 488 |
| 487 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 489 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 488 }; | 490 }; |
| 489 | 491 |
| 490 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 492 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |