OLD | NEW |
---|---|
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "chrome/browser/dom_ui/downloads_dom_handler.h" | 5 #include "chrome/browser/dom_ui/downloads_dom_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gfx/png_encoder.h" | 9 #include "base/gfx/png_encoder.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 amount.assign(received_size); | 325 amount.assign(received_size); |
326 } | 326 } |
327 amount_units = GetByteDisplayUnits(download->CurrentSpeed()); | 327 amount_units = GetByteDisplayUnits(download->CurrentSpeed()); |
328 std::wstring speed_text = FormatSpeed(download->CurrentSpeed(), | 328 std::wstring speed_text = FormatSpeed(download->CurrentSpeed(), |
329 amount_units, true); | 329 amount_units, true); |
330 std::wstring speed_text_localized; | 330 std::wstring speed_text_localized; |
331 if (l10n_util::AdjustStringForLocaleDirection(speed_text, | 331 if (l10n_util::AdjustStringForLocaleDirection(speed_text, |
332 &speed_text_localized)) | 332 &speed_text_localized)) |
333 speed_text.assign(speed_text_localized); | 333 speed_text.assign(speed_text_localized); |
334 | 334 |
335 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_SPEED, | 335 |
336 base::TimeDelta remaining; | |
337 std::wstring time_remaining; | |
338 if (download->is_paused()) | |
339 time_remaining = l10n_util::GetString(IDS_DOWNLOAD_PROGRESS_PAUSED); | |
340 else if (download->TimeRemaining(&remaining)) | |
341 time_remaining = TimeFormat::TimeRemaining(remaining); | |
342 | |
343 if (time_remaining.empty()) | |
344 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, | |
Peter Kasting
2009/05/26 23:18:30
Nit: Now, on _this_ conditional body, since it's >
| |
345 speed_text, | |
346 amount); | |
347 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, | |
336 speed_text, | 348 speed_text, |
337 amount); | 349 amount, |
350 time_remaining); | |
338 } | 351 } |
OLD | NEW |