| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // DownloadUrlParameters can-not include resource_dispatcher_host_impl.h, so | 54 // DownloadUrlParameters can-not include resource_dispatcher_host_impl.h, so |
| 55 // we must down cast. RDHI is the only subclass of RDH as of 2012 May 4. | 55 // we must down cast. RDHI is the only subclass of RDH as of 2012 May 4. |
| 56 scoped_ptr<net::URLRequest> request( | 56 scoped_ptr<net::URLRequest> request( |
| 57 params->resource_context()->GetRequestContext()->CreateRequest( | 57 params->resource_context()->GetRequestContext()->CreateRequest( |
| 58 params->url(), NULL)); | 58 params->url(), NULL)); |
| 59 request->set_referrer(params->referrer().url.spec()); | 59 request->set_referrer(params->referrer().url.spec()); |
| 60 webkit_glue::ConfigureURLRequestForReferrerPolicy( | 60 webkit_glue::ConfigureURLRequestForReferrerPolicy( |
| 61 request.get(), params->referrer().policy); | 61 request.get(), params->referrer().policy); |
| 62 request->set_load_flags(request->load_flags() | params->load_flags()); | 62 request->set_load_flags(request->load_flags() | params->load_flags()); |
| 63 request->set_method(params->method()); | 63 request->set_method(params->method()); |
| 64 if (!params->post_body().empty()) | 64 if (!params->post_body().empty()) { |
| 65 request->AppendBytesToUpload(params->post_body().data(), | 65 scoped_refptr<net::UploadData> upload_data = new net::UploadData(); |
| 66 params->post_body().size()); | 66 upload_data->AppendBytes(params->post_body().data(), |
| 67 params->post_body().size()); |
| 68 request->set_upload(upload_data); |
| 69 } |
| 67 if (params->post_id() >= 0) { | 70 if (params->post_id() >= 0) { |
| 68 // The POST in this case does not have an actual body, and only works | 71 // The POST in this case does not have an actual body, and only works |
| 69 // when retrieving data from cache. This is done because we don't want | 72 // when retrieving data from cache. This is done because we don't want |
| 70 // to do a re-POST without user consent, and currently don't have a good | 73 // to do a re-POST without user consent, and currently don't have a good |
| 71 // plan on how to display the UI for that. | 74 // plan on how to display the UI for that. |
| 72 DCHECK(params->prefer_cache()); | 75 DCHECK(params->prefer_cache()); |
| 73 DCHECK(params->method() == "POST"); | 76 DCHECK(params->method() == "POST"); |
| 74 scoped_refptr<net::UploadData> upload_data = new net::UploadData(); | 77 scoped_refptr<net::UploadData> upload_data = new net::UploadData(); |
| 75 upload_data->set_identifier(params->post_id()); | 78 upload_data->set_identifier(params->post_id()); |
| 76 request->set_upload(upload_data); | 79 request->set_upload(upload_data); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 DownloadItemImpl* download) { | 840 DownloadItemImpl* download) { |
| 838 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 841 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 839 // If the rename failed, we processed an interrupt before we get here. | 842 // If the rename failed, we processed an interrupt before we get here. |
| 840 if (delegate_) { | 843 if (delegate_) { |
| 841 delegate_->UpdatePathForItemInPersistentStore( | 844 delegate_->UpdatePathForItemInPersistentStore( |
| 842 download, download->GetFullPath()); | 845 download, download->GetFullPath()); |
| 843 } | 846 } |
| 844 } | 847 } |
| 845 | 848 |
| 846 } // namespace content | 849 } // namespace content |
| OLD | NEW |