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/download_item.h" | 11 #include "chrome/browser/download/download_item.h" |
12 #include "chrome/browser/download/save_package.h" | 12 #include "chrome/browser/download/save_package.h" |
13 #include "chrome/common/time_format.h" | 13 #include "chrome/common/time_format.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 | 16 |
17 using base::TimeDelta; | 17 using base::TimeDelta; |
18 | 18 |
19 // ----------------------------------------------------------------------------- | 19 // ----------------------------------------------------------------------------- |
20 // DownloadItemModel | 20 // DownloadItemModel |
21 | 21 |
22 DownloadItemModel::DownloadItemModel(DownloadItem* download) | 22 DownloadItemModel::DownloadItemModel(DownloadItem* download) |
23 : BaseDownloadItemModel(download) { | 23 : BaseDownloadItemModel(download) { |
24 } | 24 } |
25 | 25 |
26 void DownloadItemModel::CancelTask() { | 26 void DownloadItemModel::CancelTask() { |
27 download_->Cancel(true /* update history service */); | 27 download_->Cancel(); |
28 } | 28 } |
29 | 29 |
30 string16 DownloadItemModel::GetStatusText() { | 30 string16 DownloadItemModel::GetStatusText() { |
31 int64 size = download_->received_bytes(); | 31 int64 size = download_->received_bytes(); |
32 int64 total = download_->total_bytes(); | 32 int64 total = download_->total_bytes(); |
33 | 33 |
34 DataUnits amount_units = GetByteDisplayUnits(total); | 34 DataUnits amount_units = GetByteDisplayUnits(total); |
35 const string16 simple_size = FormatBytes(size, amount_units, false); | 35 const string16 simple_size = FormatBytes(size, amount_units, false); |
36 | 36 |
37 // In RTL locales, we render the text "size/total" in an RTL context. This | 37 // In RTL locales, we render the text "size/total" in an RTL context. This |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 IDS_SAVE_PAGE_STATUS_INTERRUPTED, | 142 IDS_SAVE_PAGE_STATUS_INTERRUPTED, |
143 base::FormatNumber(size), | 143 base::FormatNumber(size), |
144 base::FormatNumber(total_size)); | 144 base::FormatNumber(total_size)); |
145 break; | 145 break; |
146 default: | 146 default: |
147 NOTREACHED(); | 147 NOTREACHED(); |
148 } | 148 } |
149 | 149 |
150 return status_text; | 150 return status_text; |
151 } | 151 } |
OLD | NEW |