| 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 29 matching lines...) Expand all Loading... |
| 40 class ResourceMessageFilter; | 40 class ResourceMessageFilter; |
| 41 class SafeBrowsingService; | 41 class SafeBrowsingService; |
| 42 class SaveFileManager; | 42 class SaveFileManager; |
| 43 class SSLClientAuthHandler; | 43 class SSLClientAuthHandler; |
| 44 class WebKitThread; | 44 class WebKitThread; |
| 45 struct DownloadSaveInfo; | 45 struct DownloadSaveInfo; |
| 46 struct GlobalRequestID; | 46 struct GlobalRequestID; |
| 47 struct ResourceHostMsg_Request; | 47 struct ResourceHostMsg_Request; |
| 48 struct ViewMsg_ClosePage_Params; | 48 struct ViewMsg_ClosePage_Params; |
| 49 | 49 |
| 50 namespace net { | 50 namespace content { |
| 51 class URLRequestContext; | 51 class ResourceContext; |
| 52 } // namespace net | 52 } |
| 53 | 53 |
| 54 namespace webkit_blob { | 54 namespace webkit_blob { |
| 55 class DeletableFileReference; | 55 class DeletableFileReference; |
| 56 } | 56 } |
| 57 | 57 |
| 58 class ResourceDispatcherHost : public net::URLRequest::Delegate { | 58 class ResourceDispatcherHost : public net::URLRequest::Delegate { |
| 59 public: | 59 public: |
| 60 class Observer { | 60 class Observer { |
| 61 public: | 61 public: |
| 62 virtual ~Observer() {} | 62 virtual ~Observer() {} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 bool* message_was_ok); | 87 bool* message_was_ok); |
| 88 | 88 |
| 89 // Initiates a download from the browser process (as opposed to a resource | 89 // Initiates a download from the browser process (as opposed to a resource |
| 90 // request from the renderer or another child process). | 90 // request from the renderer or another child process). |
| 91 void BeginDownload(const GURL& url, | 91 void BeginDownload(const GURL& url, |
| 92 const GURL& referrer, | 92 const GURL& referrer, |
| 93 const DownloadSaveInfo& save_info, | 93 const DownloadSaveInfo& save_info, |
| 94 bool prompt_for_save_location, | 94 bool prompt_for_save_location, |
| 95 int process_unique_id, | 95 int process_unique_id, |
| 96 int route_id, | 96 int route_id, |
| 97 net::URLRequestContext* request_context); | 97 const content::ResourceContext& context); |
| 98 | 98 |
| 99 // Initiates a save file from the browser process (as opposed to a resource | 99 // Initiates a save file from the browser process (as opposed to a resource |
| 100 // request from the renderer or another child process). | 100 // request from the renderer or another child process). |
| 101 void BeginSaveFile(const GURL& url, | 101 void BeginSaveFile(const GURL& url, |
| 102 const GURL& referrer, | 102 const GURL& referrer, |
| 103 int process_unique_id, | 103 int process_unique_id, |
| 104 int route_id, | 104 int route_id, |
| 105 net::URLRequestContext* request_context); | 105 const content::ResourceContext& context); |
| 106 | 106 |
| 107 // Cancels the given request if it still exists. We ignore cancels from the | 107 // Cancels the given request if it still exists. We ignore cancels from the |
| 108 // renderer in the event of a download. | 108 // renderer in the event of a download. |
| 109 void CancelRequest(int process_unique_id, | 109 void CancelRequest(int process_unique_id, |
| 110 int request_id, | 110 int request_id, |
| 111 bool from_renderer); | 111 bool from_renderer); |
| 112 | 112 |
| 113 // Follows a deferred redirect for the given request. | 113 // Follows a deferred redirect for the given request. |
| 114 // new_first_party_for_cookies, if non-empty, is the new cookie policy URL | 114 // new_first_party_for_cookies, if non-empty, is the new cookie policy URL |
| 115 // for the redirected URL. If the cookie policy URL needs changing, pass | 115 // 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... |
| 186 const GURL& new_url, | 186 const GURL& new_url, |
| 187 bool* defer_redirect); | 187 bool* defer_redirect); |
| 188 virtual void OnAuthRequired(net::URLRequest* request, | 188 virtual void OnAuthRequired(net::URLRequest* request, |
| 189 net::AuthChallengeInfo* auth_info); | 189 net::AuthChallengeInfo* auth_info); |
| 190 virtual void OnCertificateRequested( | 190 virtual void OnCertificateRequested( |
| 191 net::URLRequest* request, | 191 net::URLRequest* request, |
| 192 net::SSLCertRequestInfo* cert_request_info); | 192 net::SSLCertRequestInfo* cert_request_info); |
| 193 virtual void OnSSLCertificateError(net::URLRequest* request, | 193 virtual void OnSSLCertificateError(net::URLRequest* request, |
| 194 int cert_error, | 194 int cert_error, |
| 195 net::X509Certificate* cert); | 195 net::X509Certificate* cert); |
| 196 virtual void OnGetCookies(net::URLRequest* request, | 196 virtual bool CanGetCookies(net::URLRequest* request); |
| 197 bool blocked_by_policy); | 197 virtual bool CanSetCookie(net::URLRequest* request, |
| 198 virtual void OnSetCookie(net::URLRequest* request, | 198 const std::string& cookie_line, |
| 199 const std::string& cookie_line, | 199 net::CookieOptions* options); |
| 200 const net::CookieOptions& options, | |
| 201 bool blocked_by_policy); | |
| 202 virtual void OnResponseStarted(net::URLRequest* request); | 200 virtual void OnResponseStarted(net::URLRequest* request); |
| 203 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); | 201 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); |
| 204 void OnResponseCompleted(net::URLRequest* request); | 202 void OnResponseCompleted(net::URLRequest* request); |
| 205 | 203 |
| 206 // Helper functions to get our extra data out of a request. The given request | 204 // Helper functions to get our extra data out of a request. The given request |
| 207 // must have been one we created so that it has the proper extra data pointer. | 205 // must have been one we created so that it has the proper extra data pointer. |
| 208 static ResourceDispatcherHostRequestInfo* InfoForRequest( | 206 static ResourceDispatcherHostRequestInfo* InfoForRequest( |
| 209 net::URLRequest* request); | 207 net::URLRequest* request); |
| 210 static const ResourceDispatcherHostRequestInfo* InfoForRequest( | 208 static const ResourceDispatcherHostRequestInfo* InfoForRequest( |
| 211 const net::URLRequest* request); | 209 const net::URLRequest* request); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 bool IsPrerenderingChildRoutePair(int child_id, int route_id) const; | 408 bool IsPrerenderingChildRoutePair(int child_id, int route_id) const; |
| 411 | 409 |
| 412 ResourceHandler* CreateSafeBrowsingResourceHandler( | 410 ResourceHandler* CreateSafeBrowsingResourceHandler( |
| 413 ResourceHandler* handler, int child_id, int route_id, | 411 ResourceHandler* handler, int child_id, int route_id, |
| 414 ResourceType::Type resource_type); | 412 ResourceType::Type resource_type); |
| 415 | 413 |
| 416 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request | 414 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request |
| 417 // (a download or a page save). |download| should be true if the request | 415 // (a download or a page save). |download| should be true if the request |
| 418 // is a file download. | 416 // is a file download. |
| 419 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( | 417 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( |
| 420 ResourceHandler* handler, int child_id, int route_id, bool download); | 418 ResourceHandler* handler, |
| 419 int child_id, |
| 420 int route_id, |
| 421 bool download, |
| 422 const content::ResourceContext& context); |
| 421 | 423 |
| 422 // Returns true if |request| is in |pending_requests_|. | 424 // Returns true if |request| is in |pending_requests_|. |
| 423 bool IsValidRequest(net::URLRequest* request); | 425 bool IsValidRequest(net::URLRequest* request); |
| 424 | 426 |
| 425 // Determine request priority based on how critical this resource typically | 427 // Determine request priority based on how critical this resource typically |
| 426 // is to user-perceived page load performance. | 428 // is to user-perceived page load performance. |
| 427 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type, | 429 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type, |
| 428 int load_flags); | 430 int load_flags); |
| 429 | 431 |
| 430 // Sends the given notification on the UI thread. The RenderViewHost's | 432 // Sends the given notification on the UI thread. The RenderViewHost's |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 ResourceMessageFilter* filter_; | 511 ResourceMessageFilter* filter_; |
| 510 | 512 |
| 511 static bool is_prefetch_enabled_; | 513 static bool is_prefetch_enabled_; |
| 512 PrerenderChildRouteIdPairs prerender_child_route_pairs_; | 514 PrerenderChildRouteIdPairs prerender_child_route_pairs_; |
| 513 | 515 |
| 514 | 516 |
| 515 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 517 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 516 }; | 518 }; |
| 517 | 519 |
| 518 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 520 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |