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 27 matching lines...) Expand all Loading... | |
38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
39 #include "content/public/browser/resource_dispatcher_host.h" | 39 #include "content/public/browser/resource_dispatcher_host.h" |
40 #include "content/public/common/resource_type.h" | 40 #include "content/public/common/resource_type.h" |
41 #include "ipc/ipc_message.h" | 41 #include "ipc/ipc_message.h" |
42 #include "net/cookies/canonical_cookie.h" | 42 #include "net/cookies/canonical_cookie.h" |
43 #include "net/url_request/url_request.h" | 43 #include "net/url_request/url_request.h" |
44 | 44 |
45 class ResourceHandler; | 45 class ResourceHandler; |
46 struct ResourceHostMsg_Request; | 46 struct ResourceHostMsg_Request; |
47 | 47 |
48 namespace base { | |
49 class FilePath; | |
50 } | |
51 | |
48 namespace net { | 52 namespace net { |
49 class URLRequestJobFactory; | 53 class URLRequestJobFactory; |
50 } | 54 } |
51 | 55 |
52 namespace storage { | 56 namespace storage { |
53 class ShareableFileReference; | 57 class ShareableFileReference; |
54 } | 58 } |
55 | 59 |
56 namespace content { | 60 namespace content { |
57 class AppCacheService; | 61 class AppCacheService; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 // |id| should be |content::DownloadItem::kInvalidId| to request automatic | 230 // |id| should be |content::DownloadItem::kInvalidId| to request automatic |
227 // assignment. This is marked virtual so it can be overriden in testing. | 231 // assignment. This is marked virtual so it can be overriden in testing. |
228 virtual scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 232 virtual scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
229 net::URLRequest* request, | 233 net::URLRequest* request, |
230 bool is_content_initiated, | 234 bool is_content_initiated, |
231 bool must_download, | 235 bool must_download, |
232 uint32 id, | 236 uint32 id, |
233 scoped_ptr<DownloadSaveInfo> save_info, | 237 scoped_ptr<DownloadSaveInfo> save_info, |
234 const DownloadUrlParameters::OnStartedCallback& started_cb); | 238 const DownloadUrlParameters::OnStartedCallback& started_cb); |
235 | 239 |
236 // Must be called after the ResourceRequestInfo has been created | 240 // Called to determine whether the response to |request| should be intercepted |
237 // and associated with the request. If |payload| is set to a non-empty value, | 241 // and handled as a stream. Streams are used to pass direct access to a |
238 // the value will be sent to the old resource handler instead of canceling | 242 // resource response to another application (e.g. a web page) without being |
239 // it, except on HTTP errors. This is marked virtual so it can be overriden in | 243 // handled by the browser itself. If the request should be intercepted as a |
240 // testing. | 244 // stream, a StreamResourceHandler is returned which provides access to the |
245 // response. |plugin_path| is the path to the plugin which is handling the | |
246 // URL request. This may be empty if there is no plugin handling the request. | |
247 // | |
248 // This function must be called after the ResourceRequestInfo has been created | |
249 // and associated with the request. If |payload| is set to a non-empty value, | |
mmenke
2015/07/09 20:35:39
This makes it sound like the RDH sends the payload
raymes
2015/07/17 03:21:00
Done.
| |
250 // the value will be sent to the old resource handler instead of canceling | |
mmenke
2015/07/09 20:35:39
"canceling" -> "canceling it."
mmenke
2015/07/09 20:35:39
"the value" -> "the value"
raymes
2015/07/17 03:21:01
Done.
raymes
2015/07/17 03:21:01
Done.
| |
241 virtual scoped_ptr<ResourceHandler> MaybeInterceptAsStream( | 251 virtual scoped_ptr<ResourceHandler> MaybeInterceptAsStream( |
252 const base::FilePath& plugin_path, | |
242 net::URLRequest* request, | 253 net::URLRequest* request, |
243 ResourceResponse* response, | 254 ResourceResponse* response, |
244 std::string* payload); | 255 std::string* payload); |
245 | 256 |
246 ResourceScheduler* scheduler() { return scheduler_.get(); } | 257 ResourceScheduler* scheduler() { return scheduler_.get(); } |
247 | 258 |
248 // Called by a ResourceHandler when it's ready to start reading data and | 259 // Called by a ResourceHandler when it's ready to start reading data and |
249 // sending it to the renderer. Returns true if there are enough file | 260 // sending it to the renderer. Returns true if there are enough file |
250 // descriptors available for the shared memory buffer. If false is returned, | 261 // descriptors available for the shared memory buffer. If false is returned, |
251 // the request should cancel. | 262 // the request should cancel. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 DelegateMap delegate_map_; | 589 DelegateMap delegate_map_; |
579 | 590 |
580 scoped_ptr<ResourceScheduler> scheduler_; | 591 scoped_ptr<ResourceScheduler> scheduler_; |
581 | 592 |
582 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 593 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
583 }; | 594 }; |
584 | 595 |
585 } // namespace content | 596 } // namespace content |
586 | 597 |
587 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 598 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |