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_request_core.h" | 5 #include "content/browser/download/download_request_core.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // If it's a download, we don't want to poison the cache with it. | 80 // If it's a download, we don't want to poison the cache with it. |
81 request()->StopCaching(); | 81 request()->StopCaching(); |
82 | 82 |
83 // Lower priority as well, so downloads don't contend for resources | 83 // Lower priority as well, so downloads don't contend for resources |
84 // with main frames. | 84 // with main frames. |
85 request()->SetPriority(net::IDLE); | 85 request()->SetPriority(net::IDLE); |
86 | 86 |
87 // If the content-length header is not present (or contains something other | 87 // If the content-length header is not present (or contains something other |
88 // than numbers), the incoming content_length is -1 (unknown size). | 88 // than numbers), the incoming content_length is -1 (unknown size). |
89 // Set the content length to 0 to indicate unknown size to DownloadManager. | 89 // Set the content length to 0 to indicate unknown size to DownloadManager. |
90 int64 content_length = request()->GetExpectedContentSize() > 0 | 90 int64_t content_length = request()->GetExpectedContentSize() > 0 |
91 ? request()->GetExpectedContentSize() | 91 ? request()->GetExpectedContentSize() |
92 : 0; | 92 : 0; |
93 | 93 |
94 // Deleted in DownloadManager. | 94 // Deleted in DownloadManager. |
95 scoped_ptr<DownloadCreateInfo> info( | 95 scoped_ptr<DownloadCreateInfo> info( |
96 new DownloadCreateInfo(base::Time::Now(), content_length, | 96 new DownloadCreateInfo(base::Time::Now(), content_length, |
97 request()->net_log(), std::move(save_info_))); | 97 request()->net_log(), std::move(save_info_))); |
98 | 98 |
99 // Create the ByteStream for sending data to the download sink. | 99 // Create the ByteStream for sending data to the download sink. |
100 CreateByteStream( | 100 CreateByteStream( |
101 base::ThreadTaskRunnerHandle::Get(), | 101 base::ThreadTaskRunnerHandle::Get(), |
102 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 102 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 std::string DownloadRequestCore::DebugString() const { | 357 std::string DownloadRequestCore::DebugString() const { |
358 return base::StringPrintf( | 358 return base::StringPrintf( |
359 "{" | 359 "{" |
360 " url_ = " | 360 " url_ = " |
361 "\"%s\"" | 361 "\"%s\"" |
362 " }", | 362 " }", |
363 request() ? request()->url().spec().c_str() : "<NULL request>"); | 363 request() ? request()->url().spec().c_str() : "<NULL request>"); |
364 } | 364 } |
365 | 365 |
366 } // namespace content | 366 } // namespace content |
OLD | NEW |