Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1256)

Side by Side Diff: chrome/browser/download/download_item_model.cc

Issue 7796014: Make cancel remove cancelled download from active queues at time of cancel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix to try to get past main waterfall failure. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/text/bytes_formatting.h" 17 #include "ui/base/text/bytes_formatting.h"
18 18
19 using base::TimeDelta; 19 using base::TimeDelta;
20 20
21 // ----------------------------------------------------------------------------- 21 // -----------------------------------------------------------------------------
22 // DownloadItemModel 22 // DownloadItemModel
23 23
24 DownloadItemModel::DownloadItemModel(DownloadItem* download) 24 DownloadItemModel::DownloadItemModel(DownloadItem* download)
25 : BaseDownloadItemModel(download) { 25 : BaseDownloadItemModel(download) {
26 } 26 }
27 27
28 void DownloadItemModel::CancelTask() { 28 void DownloadItemModel::CancelTask() {
29 download_->Cancel(true /* update history service */); 29 download_->Cancel();
30 } 30 }
31 31
32 string16 DownloadItemModel::GetStatusText() { 32 string16 DownloadItemModel::GetStatusText() {
33 int64 size = download_->received_bytes(); 33 int64 size = download_->received_bytes();
34 int64 total = download_->total_bytes(); 34 int64 total = download_->total_bytes();
35 35
36 ui::DataUnits amount_units = ui::GetByteDisplayUnits(total); 36 ui::DataUnits amount_units = ui::GetByteDisplayUnits(total);
37 string16 simple_size = ui::FormatBytesWithUnits(size, amount_units, false); 37 string16 simple_size = ui::FormatBytesWithUnits(size, amount_units, false);
38 38
39 // In RTL locales, we render the text "size/total" in an RTL context. This 39 // In RTL locales, we render the text "size/total" in an RTL context. This
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 IDS_SAVE_PAGE_STATUS_INTERRUPTED, 146 IDS_SAVE_PAGE_STATUS_INTERRUPTED,
147 base::FormatNumber(size), 147 base::FormatNumber(size),
148 base::FormatNumber(total_size)); 148 base::FormatNumber(total_size));
149 break; 149 break;
150 default: 150 default:
151 NOTREACHED(); 151 NOTREACHED();
152 } 152 }
153 153
154 return status_text; 154 return status_text;
155 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_history.cc ('k') | chrome/browser/download/download_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698