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

Side by Side Diff: chrome/browser/save_page_model.cc

Issue 3040: Move the Save Page code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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
« no previous file with comments | « chrome/browser/save_page_model.h ('k') | chrome/browser/save_page_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/save_page_model.h"
6
7 #include "base/string_util.h"
8 #include "chrome/browser/download/download_manager.h"
9 #include "chrome/browser/save_package.h"
10 #include "chrome/common/l10n_util.h"
11
12 #include "generated_resources.h"
13
14 SavePageModel::SavePageModel(SavePackage* save, DownloadItem* download)
15 : save_(save),
16 download_(download) {
17 }
18
19 void SavePageModel::CancelTask() {
20 save_->Cancel(true);
21 }
22
23 std::wstring SavePageModel::GetStatusText() {
24 int64 size = download_->received_bytes();
25 int64 total_size = download_->total_bytes();
26
27 std::wstring status_text;
28 switch (download_->state()) {
29 case DownloadItem::IN_PROGRESS:
30 status_text = l10n_util::GetStringF(IDS_SAVE_PAGE_PROGRESS,
31 FormatNumber(size),
32 FormatNumber(total_size));
33 break;
34 case DownloadItem::COMPLETE:
35 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_COMPLETED);
36 break;
37 case DownloadItem::CANCELLED:
38 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_CANCELLED);
39 break;
40 case DownloadItem::REMOVING:
41 break;
42 default:
43 NOTREACHED();
44 }
45
46 return status_text;
47 }
48
OLDNEW
« no previous file with comments | « chrome/browser/save_page_model.h ('k') | chrome/browser/save_page_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698