| 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 |
| 11 | 11 |
| 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| 13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| 14 #pragma once | 14 #pragma once |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 #include <string> | 17 #include <string> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
| 21 #include "base/gtest_prod_util.h" | 21 #include "base/gtest_prod_util.h" |
| 22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
| 23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
| 24 #include "base/time.h" | 24 #include "base/time.h" |
| 25 #include "base/timer.h" | 25 #include "base/timer.h" |
| 26 #include "content/browser/download/download_resource_handler.h" | 26 #include "content/browser/download/download_resource_handler.h" |
| 27 #include "content/browser/ssl/ssl_error_handler.h" |
| 27 #include "content/common/content_export.h" | 28 #include "content/common/content_export.h" |
| 28 #include "content/public/browser/child_process_data.h" | 29 #include "content/public/browser/child_process_data.h" |
| 29 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
| 30 #include "content/public/browser/resource_dispatcher_host.h" | 31 #include "content/public/browser/resource_dispatcher_host.h" |
| 31 #include "ipc/ipc_message.h" | 32 #include "ipc/ipc_message.h" |
| 32 #include "net/url_request/url_request.h" | 33 #include "net/url_request/url_request.h" |
| 33 #include "webkit/glue/resource_type.h" | 34 #include "webkit/glue/resource_type.h" |
| 34 | 35 |
| 35 class DownloadFileManager; | 36 class DownloadFileManager; |
| 36 class ResourceHandler; | 37 class ResourceHandler; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 } | 52 } |
| 52 | 53 |
| 53 namespace content { | 54 namespace content { |
| 54 class ResourceContext; | 55 class ResourceContext; |
| 55 class ResourceDispatcherHostDelegate; | 56 class ResourceDispatcherHostDelegate; |
| 56 class ResourceRequestInfoImpl; | 57 class ResourceRequestInfoImpl; |
| 57 struct GlobalRequestID; | 58 struct GlobalRequestID; |
| 58 | 59 |
| 59 class CONTENT_EXPORT ResourceDispatcherHostImpl | 60 class CONTENT_EXPORT ResourceDispatcherHostImpl |
| 60 : public ResourceDispatcherHost, | 61 : public ResourceDispatcherHost, |
| 61 public net::URLRequest::Delegate { | 62 public net::URLRequest::Delegate, |
| 63 public SSLErrorHandler::Delegate { |
| 62 public: | 64 public: |
| 63 ResourceDispatcherHostImpl(); | 65 ResourceDispatcherHostImpl(); |
| 64 virtual ~ResourceDispatcherHostImpl(); | 66 virtual ~ResourceDispatcherHostImpl(); |
| 65 | 67 |
| 66 // Returns the current ResourceDispatcherHostImpl. May return NULL if it | 68 // Returns the current ResourceDispatcherHostImpl. May return NULL if it |
| 67 // hasn't been created yet. | 69 // hasn't been created yet. |
| 68 static ResourceDispatcherHostImpl* Get(); | 70 static ResourceDispatcherHostImpl* Get(); |
| 69 | 71 |
| 70 // ResourceDispatcherHost implementation: | 72 // ResourceDispatcherHost implementation: |
| 71 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; | 73 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 const std::string& http_method, | 166 const std::string& http_method, |
| 165 ResourceType::Type resource_type); | 167 ResourceType::Type resource_type); |
| 166 | 168 |
| 167 // Force cancels any pending requests for the given process. | 169 // Force cancels any pending requests for the given process. |
| 168 void CancelRequestsForProcess(int child_id); | 170 void CancelRequestsForProcess(int child_id); |
| 169 | 171 |
| 170 // Force cancels any pending requests for the given route id. This method | 172 // Force cancels any pending requests for the given route id. This method |
| 171 // acts like CancelRequestsForProcess when route_id is -1. | 173 // acts like CancelRequestsForProcess when route_id is -1. |
| 172 void CancelRequestsForRoute(int child_id, int route_id); | 174 void CancelRequestsForRoute(int child_id, int route_id); |
| 173 | 175 |
| 174 // net::URLRequest::Delegate | 176 // net::URLRequest::Delegate: |
| 175 virtual void OnReceivedRedirect(net::URLRequest* request, | 177 virtual void OnReceivedRedirect(net::URLRequest* request, |
| 176 const GURL& new_url, | 178 const GURL& new_url, |
| 177 bool* defer_redirect) OVERRIDE; | 179 bool* defer_redirect) OVERRIDE; |
| 178 virtual void OnAuthRequired(net::URLRequest* request, | 180 virtual void OnAuthRequired(net::URLRequest* request, |
| 179 net::AuthChallengeInfo* auth_info) OVERRIDE; | 181 net::AuthChallengeInfo* auth_info) OVERRIDE; |
| 180 virtual void OnCertificateRequested( | 182 virtual void OnCertificateRequested( |
| 181 net::URLRequest* request, | 183 net::URLRequest* request, |
| 182 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; | 184 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; |
| 183 virtual void OnSSLCertificateError(net::URLRequest* request, | 185 virtual void OnSSLCertificateError(net::URLRequest* request, |
| 184 const net::SSLInfo& ssl_info, | 186 const net::SSLInfo& ssl_info, |
| 185 bool fatal) OVERRIDE; | 187 bool fatal) OVERRIDE; |
| 186 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; | 188 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
| 187 virtual void OnReadCompleted(net::URLRequest* request, | 189 virtual void OnReadCompleted(net::URLRequest* request, |
| 188 int bytes_read) OVERRIDE; | 190 int bytes_read) OVERRIDE; |
| 189 | 191 |
| 192 // SSLErrorHandler::Delegate: |
| 193 virtual void CancelSSLRequest(const content::GlobalRequestID& id, |
| 194 int error, |
| 195 const net::SSLInfo* ssl_info) OVERRIDE; |
| 196 virtual void ContinueSSLRequest(const content::GlobalRequestID& id) OVERRIDE; |
| 197 |
| 190 void OnUserGesture(TabContents* tab); | 198 void OnUserGesture(TabContents* tab); |
| 191 | 199 |
| 192 // Retrieves a net::URLRequest. Must be called from the IO thread. | 200 // Retrieves a net::URLRequest. Must be called from the IO thread. |
| 193 net::URLRequest* GetURLRequest( | 201 net::URLRequest* GetURLRequest( |
| 194 const GlobalRequestID& request_id) const; | 202 const GlobalRequestID& request_id) const; |
| 195 | 203 |
| 196 void RemovePendingRequest(int child_id, int request_id); | 204 void RemovePendingRequest(int child_id, int request_id); |
| 197 | 205 |
| 198 // Causes all new requests for the route identified by | 206 // Causes all new requests for the route identified by |
| 199 // |child_id| and |route_id| to be blocked (not being | 207 // |child_id| and |route_id| to be blocked (not being |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // to the respective request. | 496 // to the respective request. |
| 489 typedef std::map<GlobalRequestID, net::URLRequest*> TransferredNavigations; | 497 typedef std::map<GlobalRequestID, net::URLRequest*> TransferredNavigations; |
| 490 TransferredNavigations transferred_navigations_; | 498 TransferredNavigations transferred_navigations_; |
| 491 | 499 |
| 492 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 500 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 493 }; | 501 }; |
| 494 | 502 |
| 495 } // namespace content | 503 } // namespace content |
| 496 | 504 |
| 497 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 505 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |