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

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

Issue 10910044: Removed calls to URLRequest::URLRequest in favor of URLRequestContext::CreateRequest (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 23 matching lines...) Expand all
34 #include "content/public/browser/download_manager_delegate.h" 34 #include "content/public/browser/download_manager_delegate.h"
35 #include "content/public/browser/download_persistent_store_info.h" 35 #include "content/public/browser/download_persistent_store_info.h"
36 #include "content/public/browser/download_url_parameters.h" 36 #include "content/public/browser/download_url_parameters.h"
37 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
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 "net/base/load_flags.h" 42 #include "net/base/load_flags.h"
43 #include "net/base/upload_data.h" 43 #include "net/base/upload_data.h"
44 #include "net/url_request/url_request_context.h"
44 #include "webkit/glue/webkit_glue.h" 45 #include "webkit/glue/webkit_glue.h"
45 46
46 using content::BrowserThread; 47 using content::BrowserThread;
47 using content::DownloadId; 48 using content::DownloadId;
48 using content::DownloadItem; 49 using content::DownloadItem;
49 using content::DownloadPersistentStoreInfo; 50 using content::DownloadPersistentStoreInfo;
50 using content::ResourceDispatcherHostImpl; 51 using content::ResourceDispatcherHostImpl;
51 using content::WebContents; 52 using content::WebContents;
52 53
53 namespace { 54 namespace {
(...skipping 18 matching lines...) Expand all
72 DISALLOW_COPY_AND_ASSIGN(SavePageData); 73 DISALLOW_COPY_AND_ASSIGN(SavePageData);
73 }; 74 };
74 75
75 const char SavePageData::kKey[] = "DownloadItem SavePageData"; 76 const char SavePageData::kKey[] = "DownloadItem SavePageData";
76 77
77 void BeginDownload(content::DownloadUrlParameters* params) { 78 void BeginDownload(content::DownloadUrlParameters* params) {
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
79 // ResourceDispatcherHost{Base} is-not-a URLRequest::Delegate, and 80 // ResourceDispatcherHost{Base} is-not-a URLRequest::Delegate, and
80 // DownloadUrlParameters can-not include resource_dispatcher_host_impl.h, so 81 // DownloadUrlParameters can-not include resource_dispatcher_host_impl.h, so
81 // we must down cast. RDHI is the only subclass of RDH as of 2012 May 4. 82 // we must down cast. RDHI is the only subclass of RDH as of 2012 May 4.
82 scoped_ptr<net::URLRequest> request(new net::URLRequest( 83 scoped_ptr<net::URLRequest> request(
83 params->url(), 84 params->resource_context()->GetRequestContext()->CreateRequest(
84 NULL, 85 params->url(), NULL));
85 params->resource_context()->GetRequestContext()));
86 request->set_referrer(params->referrer().url.spec()); 86 request->set_referrer(params->referrer().url.spec());
87 webkit_glue::ConfigureURLRequestForReferrerPolicy( 87 webkit_glue::ConfigureURLRequestForReferrerPolicy(
88 request.get(), params->referrer().policy); 88 request.get(), params->referrer().policy);
89 request->set_load_flags(request->load_flags() | params->load_flags()); 89 request->set_load_flags(request->load_flags() | params->load_flags());
90 request->set_method(params->method()); 90 request->set_method(params->method());
91 if (!params->post_body().empty()) 91 if (!params->post_body().empty())
92 request->AppendBytesToUpload(params->post_body().data(), 92 request->AppendBytesToUpload(params->post_body().data(),
93 params->post_body().size()); 93 params->post_body().size());
94 if (params->post_id() >= 0) { 94 if (params->post_id() >= 0) {
95 // The POST in this case does not have an actual body, and only works 95 // The POST in this case does not have an actual body, and only works
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 void DownloadManagerImpl::DownloadRenamedToFinalName( 1090 void DownloadManagerImpl::DownloadRenamedToFinalName(
1091 DownloadItemImpl* download) { 1091 DownloadItemImpl* download) {
1092 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1092 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1093 // If the rename failed, we receive an OnDownloadInterrupted() call before we 1093 // If the rename failed, we receive an OnDownloadInterrupted() call before we
1094 // receive the DownloadRenamedToFinalName() call. 1094 // receive the DownloadRenamedToFinalName() call.
1095 if (delegate_) { 1095 if (delegate_) {
1096 delegate_->UpdatePathForItemInPersistentStore( 1096 delegate_->UpdatePathForItemInPersistentStore(
1097 download, download->GetFullPath()); 1097 download, download->GetFullPath());
1098 } 1098 }
1099 } 1099 }
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_http_handler_impl.cc ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698