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

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

Issue 10665049: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Download utility implementation 5 // Download utility implementation
6 6
7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
8 8
9 #include "chrome/browser/download/download_util.h" 9 #include "chrome/browser/download/download_util.h"
10 10
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 file_value->SetString("last_reason_text", 499 file_value->SetString("last_reason_text",
500 BaseDownloadItemModel::InterruptReasonMessage( 500 BaseDownloadItemModel::InterruptReasonMessage(
501 download->GetLastReason())); 501 download->GetLastReason()));
502 } else if (download->IsCancelled()) { 502 } else if (download->IsCancelled()) {
503 file_value->SetString("state", "CANCELLED"); 503 file_value->SetString("state", "CANCELLED");
504 } else if (download->IsComplete()) { 504 } else if (download->IsComplete()) {
505 if (download->GetSafetyState() == DownloadItem::DANGEROUS) 505 if (download->GetSafetyState() == DownloadItem::DANGEROUS)
506 file_value->SetString("state", "DANGEROUS"); 506 file_value->SetString("state", "DANGEROUS");
507 else 507 else
508 file_value->SetString("state", "COMPLETE"); 508 file_value->SetString("state", "COMPLETE");
509 } else if (download->GetState() == DownloadItem::REMOVING) {
510 file_value->SetString("state", "REMOVING");
511 } else { 509 } else {
512 NOTREACHED() << "state undefined"; 510 NOTREACHED() << "state undefined";
513 } 511 }
514 512
515 return file_value; 513 return file_value;
516 } 514 }
517 515
518 string16 GetProgressStatusText(DownloadItem* download) { 516 string16 GetProgressStatusText(DownloadItem* download) {
519 int64 total = download->GetTotalBytes(); 517 int64 total = download->GetTotalBytes();
520 int64 size = download->GetReceivedBytes(); 518 int64 size = download->GetReceivedBytes();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 UMA_HISTOGRAM_ENUMERATION( 637 UMA_HISTOGRAM_ENUMERATION(
640 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); 638 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
641 } 639 }
642 640
643 void RecordDownloadSource(ChromeDownloadSource source) { 641 void RecordDownloadSource(ChromeDownloadSource source) {
644 UMA_HISTOGRAM_ENUMERATION( 642 UMA_HISTOGRAM_ENUMERATION(
645 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); 643 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
646 } 644 }
647 645
648 } // namespace download_util 646 } // namespace download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698