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

Side by Side Diff: content/browser/loader/buffered_resource_handler.cc

Issue 11571025: Initial CL for Downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Pawel's comment. Created 7 years, 11 months 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 #include "content/browser/loader/buffered_resource_handler.h" 5 #include "content/browser/loader/buffered_resource_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "content/browser/download/download_resource_handler.h" 13 #include "content/browser/download/download_resource_handler.h"
14 #include "content/browser/download/download_stats.h" 14 #include "content/browser/download/download_stats.h"
15 #include "content/browser/loader/certificate_resource_handler.h" 15 #include "content/browser/loader/certificate_resource_handler.h"
16 #include "content/browser/loader/resource_dispatcher_host_impl.h" 16 #include "content/browser/loader/resource_dispatcher_host_impl.h"
17 #include "content/browser/loader/resource_request_info_impl.h" 17 #include "content/browser/loader/resource_request_info_impl.h"
18 #include "content/browser/plugin_service_impl.h" 18 #include "content/browser/plugin_service_impl.h"
19 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
20 #include "content/public/browser/download_id.h"
20 #include "content/public/browser/download_save_info.h" 21 #include "content/public/browser/download_save_info.h"
21 #include "content/public/browser/resource_context.h" 22 #include "content/public/browser/resource_context.h"
22 #include "content/public/browser/resource_dispatcher_host_delegate.h" 23 #include "content/public/browser/resource_dispatcher_host_delegate.h"
23 #include "content/public/common/resource_response.h" 24 #include "content/public/common/resource_response.h"
24 #include "net/base/io_buffer.h" 25 #include "net/base/io_buffer.h"
25 #include "net/base/mime_sniffer.h" 26 #include "net/base/mime_sniffer.h"
26 #include "net/base/mime_util.h" 27 #include "net/base/mime_util.h"
27 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
28 #include "net/http/http_content_disposition.h" 29 #include "net/http/http_content_disposition.h"
29 #include "net/http/http_response_headers.h" 30 #include "net/http/http_response_headers.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 #endif 336 #endif
336 } 337 }
337 338
338 // Install download handler 339 // Install download handler
339 info->set_is_download(true); 340 info->set_is_download(true);
340 scoped_ptr<ResourceHandler> handler( 341 scoped_ptr<ResourceHandler> handler(
341 host_->CreateResourceHandlerForDownload( 342 host_->CreateResourceHandlerForDownload(
342 request_, 343 request_,
343 true, // is_content_initiated 344 true, // is_content_initiated
344 must_download, 345 must_download,
346 DownloadId(),
345 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), 347 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()),
346 DownloadResourceHandler::OnStartedCallback())); 348 DownloadResourceHandler::OnStartedCallback()));
347 return UseAlternateNextHandler(handler.Pass()); 349 return UseAlternateNextHandler(handler.Pass());
348 } 350 }
349 351
350 bool BufferedResourceHandler::UseAlternateNextHandler( 352 bool BufferedResourceHandler::UseAlternateNextHandler(
351 scoped_ptr<ResourceHandler> new_handler) { 353 scoped_ptr<ResourceHandler> new_handler) {
352 if (response_->head.headers && // Can be NULL if FTP. 354 if (response_->head.headers && // Can be NULL if FTP.
353 response_->head.headers->response_code() / 100 != 2) { 355 response_->head.headers->response_code() / 100 != 2) {
354 // The response code indicates that this is an error page, but we don't 356 // The response code indicates that this is an error page, but we don't
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 const std::vector<webkit::WebPluginInfo>& plugins) { 458 const std::vector<webkit::WebPluginInfo>& plugins) {
457 bool defer = false; 459 bool defer = false;
458 if (!ProcessResponse(&defer)) { 460 if (!ProcessResponse(&defer)) {
459 controller()->Cancel(); 461 controller()->Cancel();
460 } else if (!defer) { 462 } else if (!defer) {
461 controller()->Resume(); 463 controller()->Resume();
462 } 464 }
463 } 465 }
464 466
465 } // namespace content 467 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_resource_handler.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698