| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 namespace content { | 57 namespace content { |
| 58 class ResourceContext; | 58 class ResourceContext; |
| 59 class ResourceDispatcherHostDelegate; | 59 class ResourceDispatcherHostDelegate; |
| 60 class ResourceMessageDelegate; | 60 class ResourceMessageDelegate; |
| 61 class ResourceMessageFilter; | 61 class ResourceMessageFilter; |
| 62 class ResourceRequestInfoImpl; | 62 class ResourceRequestInfoImpl; |
| 63 class SaveFileManager; | 63 class SaveFileManager; |
| 64 class WebContentsImpl; | 64 class WebContentsImpl; |
| 65 struct DownloadSaveInfo; | |
| 66 struct Referrer; | 65 struct Referrer; |
| 67 | 66 |
| 68 class CONTENT_EXPORT ResourceDispatcherHostImpl | 67 class CONTENT_EXPORT ResourceDispatcherHostImpl |
| 69 : public ResourceDispatcherHost, | 68 : public ResourceDispatcherHost, |
| 70 public ResourceLoaderDelegate { | 69 public ResourceLoaderDelegate { |
| 71 public: | 70 public: |
| 72 ResourceDispatcherHostImpl(); | 71 ResourceDispatcherHostImpl(); |
| 73 virtual ~ResourceDispatcherHostImpl(); | 72 virtual ~ResourceDispatcherHostImpl(); |
| 74 | 73 |
| 75 // Returns the current ResourceDispatcherHostImpl. May return NULL if it | 74 // Returns the current ResourceDispatcherHostImpl. May return NULL if it |
| 76 // hasn't been created yet. | 75 // hasn't been created yet. |
| 77 static ResourceDispatcherHostImpl* Get(); | 76 static ResourceDispatcherHostImpl* Get(); |
| 78 | 77 |
| 79 // ResourceDispatcherHost implementation: | 78 // ResourceDispatcherHost implementation: |
| 80 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; | 79 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; |
| 81 virtual void SetAllowCrossOriginAuthPrompt(bool value) OVERRIDE; | 80 virtual void SetAllowCrossOriginAuthPrompt(bool value) OVERRIDE; |
| 82 virtual net::Error BeginDownload( | |
| 83 scoped_ptr<net::URLRequest> request, | |
| 84 const Referrer& referrer, | |
| 85 bool is_content_initiated, | |
| 86 ResourceContext* context, | |
| 87 int child_id, | |
| 88 int route_id, | |
| 89 bool prefer_cache, | |
| 90 scoped_ptr<DownloadSaveInfo> save_info, | |
| 91 uint32 download_id, | |
| 92 const DownloadStartedCallback& started_callback) OVERRIDE; | |
| 93 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE; | 81 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE; |
| 94 virtual void BlockRequestsForRoute(int child_id, int route_id) OVERRIDE; | 82 virtual void BlockRequestsForRoute(int child_id, int route_id) OVERRIDE; |
| 95 virtual void ResumeBlockedRequestsForRoute( | 83 virtual void ResumeBlockedRequestsForRoute( |
| 96 int child_id, int route_id) OVERRIDE; | 84 int child_id, int route_id) OVERRIDE; |
| 97 | 85 |
| 98 // Puts the resource dispatcher host in an inactive state (unable to begin | 86 // Puts the resource dispatcher host in an inactive state (unable to begin |
| 99 // new requests). Cancels all pending requests. | 87 // new requests). Cancels all pending requests. |
| 100 void Shutdown(); | 88 void Shutdown(); |
| 101 | 89 |
| 102 // Notify the ResourceDispatcherHostImpl of a new resource context. | 90 // Notify the ResourceDispatcherHostImpl of a new resource context. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Indicates whether third-party sub-content can pop-up HTTP basic auth | 184 // Indicates whether third-party sub-content can pop-up HTTP basic auth |
| 197 // dialog boxes. | 185 // dialog boxes. |
| 198 bool allow_cross_origin_auth_prompt(); | 186 bool allow_cross_origin_auth_prompt(); |
| 199 | 187 |
| 200 ResourceDispatcherHostDelegate* delegate() { | 188 ResourceDispatcherHostDelegate* delegate() { |
| 201 return delegate_; | 189 return delegate_; |
| 202 } | 190 } |
| 203 | 191 |
| 204 // Must be called after the ResourceRequestInfo has been created | 192 // Must be called after the ResourceRequestInfo has been created |
| 205 // and associated with the request. | 193 // and associated with the request. |
| 206 // |id| should be |content::DownloadItem::kInvalidId| to request automatic | |
| 207 // assignment. | |
| 208 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 194 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
| 209 net::URLRequest* request, | 195 net::URLRequest* request, |
| 210 bool is_content_initiated, | 196 bool must_download); |
| 211 bool must_download, | |
| 212 uint32 id, | |
| 213 scoped_ptr<DownloadSaveInfo> save_info, | |
| 214 const DownloadUrlParameters::OnStartedCallback& started_cb); | |
| 215 | 197 |
| 216 // Must be called after the ResourceRequestInfo has been created | 198 // Must be called after the ResourceRequestInfo has been created |
| 217 // and associated with the request. | 199 // and associated with the request. |
| 218 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( | 200 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( |
| 219 net::URLRequest* request, | 201 net::URLRequest* request, |
| 220 ResourceResponse* response); | 202 ResourceResponse* response); |
| 221 | 203 |
| 222 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); | 204 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); |
| 223 | 205 |
| 224 ResourceScheduler* scheduler() { return scheduler_.get(); } | 206 ResourceScheduler* scheduler() { return scheduler_.get(); } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 typedef std::map<GlobalRoutingID, OfflinePolicy*> OfflineMap; | 481 typedef std::map<GlobalRoutingID, OfflinePolicy*> OfflineMap; |
| 500 | 482 |
| 501 OfflineMap offline_policy_map_; | 483 OfflineMap offline_policy_map_; |
| 502 | 484 |
| 503 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 485 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 504 }; | 486 }; |
| 505 | 487 |
| 506 } // namespace content | 488 } // namespace content |
| 507 | 489 |
| 508 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 490 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |