| 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 "chrome/browser/download/download_item_model.h" | 5 #include "chrome/browser/download/download_item_model.h" |
| 6 | 6 |
| 7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 11 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 12 #include "chrome/common/time_format.h" | 12 #include "chrome/common/time_format.h" |
| 13 #include "content/browser/download/download_item.h" | 13 #include "content/browser/download/download_item.h" |
| 14 #include "content/browser/download/save_package.h" | 14 #include "content/browser/download/save_package.h" |
| 15 #include "grit/chromium_strings.h" |
| 15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/text/bytes_formatting.h" | 18 #include "ui/base/text/bytes_formatting.h" |
| 18 | 19 |
| 19 using base::TimeDelta; | 20 using base::TimeDelta; |
| 20 | 21 |
| 21 // ----------------------------------------------------------------------------- | 22 // ----------------------------------------------------------------------------- |
| 22 // DownloadItemModel | 23 // DownloadItemModel |
| 23 | 24 |
| 24 DownloadItemModel::DownloadItemModel(DownloadItem* download) | 25 DownloadItemModel::DownloadItemModel(DownloadItem* download) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 } | 56 } |
| 56 | 57 |
| 57 string16 status_text; | 58 string16 status_text; |
| 58 switch (download_->GetState()) { | 59 switch (download_->GetState()) { |
| 59 case DownloadItem::IN_PROGRESS: | 60 case DownloadItem::IN_PROGRESS: |
| 60 if (ChromeDownloadManagerDelegate::IsExtensionDownload(download_) && | 61 if (ChromeDownloadManagerDelegate::IsExtensionDownload(download_) && |
| 61 download_->AllDataSaved() && | 62 download_->AllDataSaved() && |
| 62 download_->GetState() == DownloadItem::IN_PROGRESS) { | 63 download_->GetState() == DownloadItem::IN_PROGRESS) { |
| 63 // The download is a CRX (app, extension, theme, ...) and it is | 64 // The download is a CRX (app, extension, theme, ...) and it is |
| 64 // being unpacked and validated. | 65 // being unpacked and validated. |
| 65 status_text = l10n_util::GetStringUTF16( | 66 status_text = l10n_util::GetStringFUTF16( |
| 66 IDS_DOWNLOAD_STATUS_CRX_INSTALL_RUNNING); | 67 IDS_DOWNLOAD_STATUS_CRX_INSTALL_RUNNING, |
| 68 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
| 67 } else if (download_->GetOpenWhenComplete()) { | 69 } else if (download_->GetOpenWhenComplete()) { |
| 68 if (simple_time.empty()) { | 70 if (simple_time.empty()) { |
| 69 status_text = | 71 status_text = |
| 70 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE); | 72 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE); |
| 71 } else { | 73 } else { |
| 72 status_text = l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPEN_IN, | 74 status_text = l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPEN_IN, |
| 73 simple_time); | 75 simple_time); |
| 74 } | 76 } |
| 75 } else { | 77 } else { |
| 76 if (simple_time.empty()) { | 78 if (simple_time.empty()) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 IDS_SAVE_PAGE_STATUS_INTERRUPTED, | 148 IDS_SAVE_PAGE_STATUS_INTERRUPTED, |
| 147 base::FormatNumber(size), | 149 base::FormatNumber(size), |
| 148 base::FormatNumber(total_size)); | 150 base::FormatNumber(total_size)); |
| 149 break; | 151 break; |
| 150 default: | 152 default: |
| 151 NOTREACHED(); | 153 NOTREACHED(); |
| 152 } | 154 } |
| 153 | 155 |
| 154 return status_text; | 156 return status_text; |
| 155 } | 157 } |
| OLD | NEW |