| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 bool has_etag = !params->etag().empty(); | 88 bool has_etag = !params->etag().empty(); |
| 89 | 89 |
| 90 // If we've asked for a range, we want to make sure that we only | 90 // If we've asked for a range, we want to make sure that we only |
| 91 // get that range if our current copy of the information is good. | 91 // get that range if our current copy of the information is good. |
| 92 // We shouldn't be asked to continue if we don't have a verifier. | 92 // We shouldn't be asked to continue if we don't have a verifier. |
| 93 DCHECK(params->offset() == 0 || has_etag || has_last_modified); | 93 DCHECK(params->offset() == 0 || has_etag || has_last_modified); |
| 94 | 94 |
| 95 if (params->offset() > 0) { | 95 if (params->offset() > 0) { |
| 96 request->SetExtraRequestHeaderByName( | 96 request->SetExtraRequestHeaderByName( |
| 97 "Range", | 97 "Range", |
| 98 StringPrintf("bytes=%" PRId64 "-", params->offset()), | 98 base::StringPrintf("bytes=%" PRId64 "-", params->offset()), |
| 99 true); | 99 true); |
| 100 | 100 |
| 101 if (has_last_modified) { | 101 if (has_last_modified) { |
| 102 request->SetExtraRequestHeaderByName("If-Unmodified-Since", | 102 request->SetExtraRequestHeaderByName("If-Unmodified-Since", |
| 103 params->last_modified(), | 103 params->last_modified(), |
| 104 true); | 104 true); |
| 105 } | 105 } |
| 106 if (has_etag) { | 106 if (has_etag) { |
| 107 request->SetExtraRequestHeaderByName("If-Match", params->etag(), true); | 107 request->SetExtraRequestHeaderByName("If-Match", params->etag(), true); |
| 108 } | 108 } |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 if (delegate_) | 662 if (delegate_) |
| 663 delegate_->OpenDownload(download); | 663 delegate_->OpenDownload(download); |
| 664 } | 664 } |
| 665 | 665 |
| 666 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 666 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 667 if (delegate_) | 667 if (delegate_) |
| 668 delegate_->ShowDownloadInShell(download); | 668 delegate_->ShowDownloadInShell(download); |
| 669 } | 669 } |
| 670 | 670 |
| 671 } // namespace content | 671 } // namespace content |
| OLD | NEW |