| 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(FROM_HERE, | 328 update_timer_.Start(base::TimeDelta::FromMilliseconds(kUpdateTimeMs), this, |
| 329 base::TimeDelta::FromMilliseconds(kUpdateTimeMs), this, | |
| 330 &DownloadItem::UpdateObservers); | 329 &DownloadItem::UpdateObservers); |
| 331 } | 330 } |
| 332 | 331 |
| 333 void DownloadItem::StopProgressTimer() { | 332 void DownloadItem::StopProgressTimer() { |
| 334 // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved. | 333 // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved. |
| 335 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 334 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 336 | 335 |
| 337 update_timer_.Stop(); | 336 update_timer_.Stop(); |
| 338 } | 337 } |
| 339 | 338 |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 state_info_.target_name.value().c_str(), | 796 state_info_.target_name.value().c_str(), |
| 798 full_path().value().c_str()); | 797 full_path().value().c_str()); |
| 799 } else { | 798 } else { |
| 800 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); | 799 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); |
| 801 } | 800 } |
| 802 | 801 |
| 803 description += " }"; | 802 description += " }"; |
| 804 | 803 |
| 805 return description; | 804 return description; |
| 806 } | 805 } |
| OLD | NEW |