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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 8770024: Added a download file factory to the download file manager, for testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with trunk. Created 9 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
OLDNEW
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/debug/alias.h" 16 #include "base/debug/alias.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/message_loop.h" 19 #include "base/message_loop.h"
20 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
21 #include "base/shared_memory.h" 21 #include "base/shared_memory.h"
22 #include "base/stl_util.h" 22 #include "base/stl_util.h"
23 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 23 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
24 #include "content/browser/appcache/chrome_appcache_service.h" 24 #include "content/browser/appcache/chrome_appcache_service.h"
25 #include "content/browser/cert_store.h" 25 #include "content/browser/cert_store.h"
26 #include "content/browser/child_process_security_policy.h" 26 #include "content/browser/child_process_security_policy.h"
27 #include "content/browser/chrome_blob_storage_context.h" 27 #include "content/browser/chrome_blob_storage_context.h"
28 #include "content/browser/cross_site_request_manager.h" 28 #include "content/browser/cross_site_request_manager.h"
29 #include "content/browser/download/download_file_manager.h" 29 #include "content/browser/download/download_file_manager.h"
30 #include "content/browser/download/download_file_impl.h"
30 #include "content/browser/download/download_id_factory.h" 31 #include "content/browser/download/download_id_factory.h"
31 #include "content/browser/download/download_manager.h" 32 #include "content/browser/download/download_manager.h"
32 #include "content/browser/download/download_resource_handler.h" 33 #include "content/browser/download/download_resource_handler.h"
33 #include "content/browser/download/save_file_manager.h" 34 #include "content/browser/download/save_file_manager.h"
34 #include "content/browser/download/save_file_resource_handler.h" 35 #include "content/browser/download/save_file_resource_handler.h"
35 #include "content/browser/plugin_service.h" 36 #include "content/browser/plugin_service.h"
36 #include "content/browser/renderer_host/async_resource_handler.h" 37 #include "content/browser/renderer_host/async_resource_handler.h"
37 #include "content/browser/renderer_host/buffered_resource_handler.h" 38 #include "content/browser/renderer_host/buffered_resource_handler.h"
38 #include "content/browser/renderer_host/cross_site_resource_handler.h" 39 #include "content/browser/renderer_host/cross_site_resource_handler.h"
39 #include "content/browser/renderer_host/global_request_id.h" 40 #include "content/browser/renderer_host/global_request_id.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 const int kUserGestureWindowMs = 3500; 113 const int kUserGestureWindowMs = 3500;
113 114
114 // All possible error codes from the network module. Note that the error codes 115 // All possible error codes from the network module. Note that the error codes
115 // are all positive (since histograms expect positive sample values). 116 // are all positive (since histograms expect positive sample values).
116 const int kAllNetErrorCodes[] = { 117 const int kAllNetErrorCodes[] = {
117 #define NET_ERROR(label, value) -(value), 118 #define NET_ERROR(label, value) -(value),
118 #include "net/base/net_error_list.h" 119 #include "net/base/net_error_list.h"
119 #undef NET_ERROR 120 #undef NET_ERROR
120 }; 121 };
121 122
123 class StandardDownloadFileFactory
Randy Smith (Not in Mondays) 2011/12/05 22:25:38 I don't think this belongs in ResourceDispatcherHo
cbentzel 2011/12/07 18:58:21 I agree that the definition doesn't belong in RDH.
ahendrickson 2011/12/07 19:55:15 I like option 3. Done.
ahendrickson 2011/12/07 19:55:15 Renamed, and moved into DownloadFileManager.cc. U
124 : public DownloadFileManager::DownloadFileFactory {
125 public:
126 StandardDownloadFileFactory() {}
127
128 virtual DownloadFile* GetFile(DownloadCreateInfo* info,
129 const DownloadRequestHandle& request_handle,
130 DownloadManager* download_manager) OVERRIDE;
131 };
132
133 DownloadFile* StandardDownloadFileFactory::GetFile(
134 DownloadCreateInfo* info,
135 const DownloadRequestHandle& request_handle,
136 DownloadManager* download_manager) {
137 return new DownloadFileImpl(info,
138 new DownloadRequestHandle(request_handle),
139 download_manager);
140 }
141
122 // Aborts a request before an URLRequest has actually been created. 142 // Aborts a request before an URLRequest has actually been created.
123 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, 143 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter,
124 IPC::Message* sync_result, 144 IPC::Message* sync_result,
125 int route_id, 145 int route_id,
126 int request_id) { 146 int request_id) {
127 net::URLRequestStatus status(net::URLRequestStatus::FAILED, 147 net::URLRequestStatus status(net::URLRequestStatus::FAILED,
128 net::ERR_ABORTED); 148 net::ERR_ABORTED);
129 if (sync_result) { 149 if (sync_result) {
130 content::SyncLoadResult result; 150 content::SyncLoadResult result;
131 result.status = status; 151 result.status = status;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 render_view_id); 305 render_view_id);
286 if (rvh) 306 if (rvh)
287 rvh->OnSwapOutACK(); 307 rvh->OnSwapOutACK();
288 } 308 }
289 309
290 } // namespace 310 } // namespace
291 311
292 ResourceDispatcherHost::ResourceDispatcherHost( 312 ResourceDispatcherHost::ResourceDispatcherHost(
293 const ResourceQueue::DelegateSet& resource_queue_delegates) 313 const ResourceQueue::DelegateSet& resource_queue_delegates)
294 : ALLOW_THIS_IN_INITIALIZER_LIST( 314 : ALLOW_THIS_IN_INITIALIZER_LIST(
295 download_file_manager_(new DownloadFileManager(this))), 315 download_file_manager_(new DownloadFileManager(
316 this,
317 new StandardDownloadFileFactory))),
296 ALLOW_THIS_IN_INITIALIZER_LIST( 318 ALLOW_THIS_IN_INITIALIZER_LIST(
297 save_file_manager_(new SaveFileManager(this))), 319 save_file_manager_(new SaveFileManager(this))),
298 request_id_(-1), 320 request_id_(-1),
299 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 321 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
300 is_shutdown_(false), 322 is_shutdown_(false),
301 max_outstanding_requests_cost_per_process_( 323 max_outstanding_requests_cost_per_process_(
302 kMaxOutstandingRequestsCostPerProcess), 324 kMaxOutstandingRequestsCostPerProcess),
303 filter_(NULL), 325 filter_(NULL),
304 delegate_(NULL), 326 delegate_(NULL),
305 allow_cross_origin_auth_prompt_(false) { 327 allow_cross_origin_auth_prompt_(false) {
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; 2194 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS;
2173 } 2195 }
2174 2196
2175 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { 2197 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() {
2176 return allow_cross_origin_auth_prompt_; 2198 return allow_cross_origin_auth_prompt_;
2177 } 2199 }
2178 2200
2179 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { 2201 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) {
2180 allow_cross_origin_auth_prompt_ = value; 2202 allow_cross_origin_auth_prompt_ = value;
2181 } 2203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698