Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.h

Issue 82273002: Fix various issues in RedirectToFileResourceHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "net/url_request/url_request.h" 42 #include "net/url_request/url_request.h"
43 #include "webkit/common/resource_type.h" 43 #include "webkit/common/resource_type.h"
44 44
45 class ResourceHandler; 45 class ResourceHandler;
46 struct ResourceHostMsg_Request; 46 struct ResourceHostMsg_Request;
47 47
48 namespace net { 48 namespace net {
49 class URLRequestJobFactory; 49 class URLRequestJobFactory;
50 } 50 }
51 51
52 namespace webkit_blob {
53 class ShareableFileReference;
54 }
55
56 namespace content { 52 namespace content {
57 class ResourceContext; 53 class ResourceContext;
58 class ResourceDispatcherHostDelegate; 54 class ResourceDispatcherHostDelegate;
59 class ResourceMessageDelegate; 55 class ResourceMessageDelegate;
60 class ResourceMessageFilter; 56 class ResourceMessageFilter;
61 class ResourceRequestInfoImpl; 57 class ResourceRequestInfoImpl;
62 class SaveFileManager; 58 class SaveFileManager;
59 class TemporaryFileManager;
63 class WebContentsImpl; 60 class WebContentsImpl;
64 struct DownloadSaveInfo; 61 struct DownloadSaveInfo;
65 struct Referrer; 62 struct Referrer;
66 63
67 class CONTENT_EXPORT ResourceDispatcherHostImpl 64 class CONTENT_EXPORT ResourceDispatcherHostImpl
68 : public ResourceDispatcherHost, 65 : public ResourceDispatcherHost,
69 public ResourceLoaderDelegate { 66 public ResourceLoaderDelegate {
70 public: 67 public:
71 ResourceDispatcherHostImpl(); 68 ResourceDispatcherHostImpl();
72 virtual ~ResourceDispatcherHostImpl(); 69 virtual ~ResourceDispatcherHostImpl();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void OnUserGesture(WebContentsImpl* contents); 170 void OnUserGesture(WebContentsImpl* contents);
174 171
175 // Retrieves a net::URLRequest. Must be called from the IO thread. 172 // Retrieves a net::URLRequest. Must be called from the IO thread.
176 net::URLRequest* GetURLRequest(const GlobalRequestID& request_id); 173 net::URLRequest* GetURLRequest(const GlobalRequestID& request_id);
177 174
178 void RemovePendingRequest(int child_id, int request_id); 175 void RemovePendingRequest(int child_id, int request_id);
179 176
180 // Cancels any blocked request for the specified route id. 177 // Cancels any blocked request for the specified route id.
181 void CancelBlockedRequestsForRoute(int child_id, int route_id); 178 void CancelBlockedRequestsForRoute(int child_id, int route_id);
182 179
183 // Maintains a collection of temp files created in support of
184 // the download_to_file capability. Used to grant access to the
185 // child process and to defer deletion of the file until it's
186 // no longer needed.
187 void RegisterDownloadedTempFile(
188 int child_id, int request_id,
189 webkit_blob::ShareableFileReference* reference);
190 void UnregisterDownloadedTempFile(int child_id, int request_id);
191
192 // Needed for the sync IPC message dispatcher macros. 180 // Needed for the sync IPC message dispatcher macros.
193 bool Send(IPC::Message* message); 181 bool Send(IPC::Message* message);
194 182
195 // Indicates whether third-party sub-content can pop-up HTTP basic auth 183 // Indicates whether third-party sub-content can pop-up HTTP basic auth
196 // dialog boxes. 184 // dialog boxes.
197 bool allow_cross_origin_auth_prompt(); 185 bool allow_cross_origin_auth_prompt();
198 186
199 ResourceDispatcherHostDelegate* delegate() { 187 ResourceDispatcherHostDelegate* delegate() {
200 return delegate_; 188 return delegate_;
201 } 189 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ResourceMessageDelegate* delegate); 413 ResourceMessageDelegate* delegate);
426 void UnregisterResourceMessageDelegate(const GlobalRequestID& id, 414 void UnregisterResourceMessageDelegate(const GlobalRequestID& id,
427 ResourceMessageDelegate* delegate); 415 ResourceMessageDelegate* delegate);
428 416
429 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data, 417 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data,
430 int child_id, 418 int child_id,
431 bool is_sync_load); 419 bool is_sync_load);
432 420
433 LoaderMap pending_loaders_; 421 LoaderMap pending_loaders_;
434 422
435 // Collection of temp files downloaded for child processes via
436 // the download_to_file mechanism. We avoid deleting them until
437 // the client no longer needs them.
438 typedef std::map<int, scoped_refptr<webkit_blob::ShareableFileReference> >
439 DeletableFilesMap; // key is request id
440 typedef std::map<int, DeletableFilesMap>
441 RegisteredTempFiles; // key is child process id
442 RegisteredTempFiles registered_temp_files_;
443
444 // A timer that periodically calls UpdateLoadStates while pending_requests_ 423 // A timer that periodically calls UpdateLoadStates while pending_requests_
445 // is not empty. 424 // is not empty.
446 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > 425 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> >
447 update_load_states_timer_; 426 update_load_states_timer_;
448 427
449 // We own the save file manager. 428 // We own the save file manager.
450 scoped_refptr<SaveFileManager> save_file_manager_; 429 scoped_refptr<SaveFileManager> save_file_manager_;
451 430
452 // Request ID for browser initiated requests. request_ids generated by 431 // Request ID for browser initiated requests. request_ids generated by
453 // child processes are counted up from 0, while browser created requests 432 // child processes are counted up from 0, while browser created requests
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // http://crbug.com/90971 - Assists in tracking down use-after-frees on 490 // http://crbug.com/90971 - Assists in tracking down use-after-frees on
512 // shutdown. 491 // shutdown.
513 std::set<const ResourceContext*> active_resource_contexts_; 492 std::set<const ResourceContext*> active_resource_contexts_;
514 493
515 typedef std::map<GlobalRequestID, 494 typedef std::map<GlobalRequestID,
516 ObserverList<ResourceMessageDelegate>*> DelegateMap; 495 ObserverList<ResourceMessageDelegate>*> DelegateMap;
517 DelegateMap delegate_map_; 496 DelegateMap delegate_map_;
518 497
519 scoped_ptr<ResourceScheduler> scheduler_; 498 scoped_ptr<ResourceScheduler> scheduler_;
520 499
500 scoped_ptr<TemporaryFileManager> temporary_file_manager_;
501
521 typedef std::map<GlobalRoutingID, OfflinePolicy*> OfflineMap; 502 typedef std::map<GlobalRoutingID, OfflinePolicy*> OfflineMap;
522 503
523 OfflineMap offline_policy_map_; 504 OfflineMap offline_policy_map_;
524 505
525 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 506 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
526 }; 507 };
527 508
528 } // namespace content 509 } // namespace content
529 510
530 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 511 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698