| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_item.h" | 5 #include "content/browser/download/download_item.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // If we've received more data than we were expecting (bad server info?), | 318 // If we've received more data than we were expecting (bad server info?), |
| 319 // revert to 'unknown size mode'. | 319 // revert to 'unknown size mode'. |
| 320 if (received_bytes_ > total_bytes_) | 320 if (received_bytes_ > total_bytes_) |
| 321 total_bytes_ = 0; | 321 total_bytes_ = 0; |
| 322 } | 322 } |
| 323 | 323 |
| 324 void DownloadItem::StartProgressTimer() { | 324 void DownloadItem::StartProgressTimer() { |
| 325 // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved. | 325 // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved. |
| 326 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 326 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 327 | 327 |
| 328 update_timer_.Start(base::TimeDelta::FromMilliseconds(kUpdateTimeMs), this, | 328 update_timer_.Start(FROM_HERE, |
| 329 base::TimeDelta::FromMilliseconds(kUpdateTimeMs), this, |
| 329 &DownloadItem::UpdateObservers); | 330 &DownloadItem::UpdateObservers); |
| 330 } | 331 } |
| 331 | 332 |
| 332 void DownloadItem::StopProgressTimer() { | 333 void DownloadItem::StopProgressTimer() { |
| 333 // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved. | 334 // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved. |
| 334 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 335 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 335 | 336 |
| 336 update_timer_.Stop(); | 337 update_timer_.Stop(); |
| 337 } | 338 } |
| 338 | 339 |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 state_info_.target_name.value().c_str(), | 797 state_info_.target_name.value().c_str(), |
| 797 full_path().value().c_str()); | 798 full_path().value().c_str()); |
| 798 } else { | 799 } else { |
| 799 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); | 800 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); |
| 800 } | 801 } |
| 801 | 802 |
| 802 description += " }"; | 803 description += " }"; |
| 803 | 804 |
| 804 return description; | 805 return description; |
| 805 } | 806 } |
| OLD | NEW |