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