| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/download/download_item_model.h" | 5 #include "chrome/browser/download/download_item_model.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/i18n/number_formatting.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "chrome/browser/download/download_manager.h" | 10 #include "chrome/browser/download/download_manager.h" |
| 10 #include "chrome/browser/download/save_package.h" | 11 #include "chrome/browser/download/save_package.h" |
| 11 #include "chrome/common/time_format.h" | 12 #include "chrome/common/time_format.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 | 14 |
| 14 using base::TimeDelta; | 15 using base::TimeDelta; |
| 15 | 16 |
| 16 // ----------------------------------------------------------------------------- | 17 // ----------------------------------------------------------------------------- |
| 17 // DownloadItemModel | 18 // DownloadItemModel |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 save_->Cancel(true); | 104 save_->Cancel(true); |
| 104 } | 105 } |
| 105 | 106 |
| 106 std::wstring SavePageModel::GetStatusText() { | 107 std::wstring SavePageModel::GetStatusText() { |
| 107 int64 size = download_->received_bytes(); | 108 int64 size = download_->received_bytes(); |
| 108 int64 total_size = download_->total_bytes(); | 109 int64 total_size = download_->total_bytes(); |
| 109 | 110 |
| 110 std::wstring status_text; | 111 std::wstring status_text; |
| 111 switch (download_->state()) { | 112 switch (download_->state()) { |
| 112 case DownloadItem::IN_PROGRESS: | 113 case DownloadItem::IN_PROGRESS: |
| 113 status_text = l10n_util::GetStringF(IDS_SAVE_PAGE_PROGRESS, | 114 status_text = l10n_util::GetStringF( |
| 114 FormatNumber(size), | 115 IDS_SAVE_PAGE_PROGRESS, |
| 115 FormatNumber(total_size)); | 116 UTF16ToWide(base::FormatNumber(size)), |
| 117 UTF16ToWide(base::FormatNumber(total_size))); |
| 116 break; | 118 break; |
| 117 case DownloadItem::COMPLETE: | 119 case DownloadItem::COMPLETE: |
| 118 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_COMPLETED); | 120 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_COMPLETED); |
| 119 break; | 121 break; |
| 120 case DownloadItem::CANCELLED: | 122 case DownloadItem::CANCELLED: |
| 121 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_CANCELED); | 123 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_CANCELED); |
| 122 break; | 124 break; |
| 123 case DownloadItem::REMOVING: | 125 case DownloadItem::REMOVING: |
| 124 break; | 126 break; |
| 125 default: | 127 default: |
| 126 NOTREACHED(); | 128 NOTREACHED(); |
| 127 } | 129 } |
| 128 | 130 |
| 129 return status_text; | 131 return status_text; |
| 130 } | 132 } |
| OLD | NEW |