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

Side by Side Diff: content/browser/download/download_manager_impl.cc

Issue 1829413002: [Downloads] Retain a BlobDataHandle in DownloadUrlParameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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/download/download_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 27 matching lines...) Expand all
38 #include "content/public/browser/notification_types.h" 38 #include "content/public/browser/notification_types.h"
39 #include "content/public/browser/render_process_host.h" 39 #include "content/public/browser/render_process_host.h"
40 #include "content/public/browser/resource_context.h" 40 #include "content/public/browser/resource_context.h"
41 #include "content/public/browser/web_contents_delegate.h" 41 #include "content/public/browser/web_contents_delegate.h"
42 #include "content/public/common/referrer.h" 42 #include "content/public/common/referrer.h"
43 #include "net/base/elements_upload_data_stream.h" 43 #include "net/base/elements_upload_data_stream.h"
44 #include "net/base/load_flags.h" 44 #include "net/base/load_flags.h"
45 #include "net/base/request_priority.h" 45 #include "net/base/request_priority.h"
46 #include "net/base/upload_bytes_element_reader.h" 46 #include "net/base/upload_bytes_element_reader.h"
47 #include "net/url_request/url_request_context.h" 47 #include "net/url_request/url_request_context.h"
48 #include "storage/browser/blob/blob_url_request_job_factory.h"
48 #include "url/origin.h" 49 #include "url/origin.h"
49 50
50 namespace content { 51 namespace content {
51 namespace { 52 namespace {
52 53
53 scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> BeginDownload( 54 scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> BeginDownload(
54 scoped_ptr<DownloadUrlParameters> params, 55 scoped_ptr<DownloadUrlParameters> params,
55 uint32_t download_id, 56 uint32_t download_id,
56 base::WeakPtr<DownloadManagerImpl> download_manager) { 57 base::WeakPtr<DownloadManagerImpl> download_manager) {
57 DCHECK_CURRENTLY_ON(BrowserThread::IO); 58 DCHECK_CURRENTLY_ON(BrowserThread::IO);
58 59
59 scoped_ptr<net::URLRequest> url_request = 60 scoped_ptr<net::URLRequest> url_request =
60 DownloadRequestCore::CreateRequestOnIOThread(download_id, params.get()); 61 DownloadRequestCore::CreateRequestOnIOThread(download_id, params.get());
62 scoped_ptr<storage::BlobDataHandle> blob_data_handle =
63 params->GetBlobDataHandle();
64 if (blob_data_handle) {
65 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
66 url_request.get(), std::move(blob_data_handle));
67 }
61 68
62 // If there's a valid renderer process associated with the request, then the 69 // If there's a valid renderer process associated with the request, then the
63 // request should be driven by the ResourceLoader. Pass it over to the 70 // request should be driven by the ResourceLoader. Pass it over to the
64 // ResourceDispatcherHostImpl which will in turn pass it along to the 71 // ResourceDispatcherHostImpl which will in turn pass it along to the
65 // ResourceLoader. 72 // ResourceLoader.
66 if (params->render_process_host_id() != -1) { 73 if (params->render_process_host_id() != -1) {
67 DownloadInterruptReason reason = 74 DownloadInterruptReason reason =
68 ResourceDispatcherHostImpl::Get()->BeginDownload( 75 ResourceDispatcherHostImpl::Get()->BeginDownload(
69 std::move(url_request), params->referrer(), 76 std::move(url_request), params->referrer(),
70 params->content_initiated(), params->resource_context(), 77 params->content_initiated(), params->resource_context(),
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 if (delegate_) 718 if (delegate_)
712 delegate_->OpenDownload(download); 719 delegate_->OpenDownload(download);
713 } 720 }
714 721
715 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { 722 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) {
716 if (delegate_) 723 if (delegate_)
717 delegate_->ShowDownloadInShell(download); 724 delegate_->ShowDownloadInShell(download);
718 } 725 }
719 726
720 } // namespace content 727 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698