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

Unified Diff: content/browser/download/download_item.cc

Issue 8008021: Add new UMA stats to get a handle on Downloads UI Usage (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_item.cc
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index bf3085f1bffbc17107901d3c9156f841db379e5b..47cc9c3295c32d4693c79c370952754037e8100b 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -129,6 +129,7 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
start_tick_(base::TimeTicks()),
state_(static_cast<DownloadState>(info.state)),
start_time_(info.start_time),
+ end_time_(info.end_time),
db_handle_(info.db_handle),
download_manager_(download_manager),
is_paused_(false),
@@ -139,7 +140,7 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
is_otr_(false),
is_temporary_(false),
all_data_saved_(false),
- opened_(false),
+ opened_(info.opened),
open_enabled_(true),
delegate_delayed_complete_(false) {
if (IsInProgress())
@@ -284,8 +285,10 @@ void DownloadItem::OpenDownload() {
// program that opens the file. So instead we spawn a check to update
// the UI if the file has been deleted in parallel with the open.
download_manager_->CheckForFileRemoval(this);
+ download_stats::RecordOpen(end_time(), !opened());
opened_ = true;
FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this));
+ download_manager_->MarkDownloadOpened(this);
// For testing: If download opening is disabled on this item,
// make the rest of the routine a no-op.
@@ -385,6 +388,7 @@ void DownloadItem::MarkAsComplete() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(all_data_saved_);
+ end_time_ = base::Time::Now();
TransitionTo(COMPLETE);
}
@@ -415,6 +419,7 @@ void DownloadItem::Completed() {
VLOG(20) << __FUNCTION__ << "() " << DebugString(false);
DCHECK(all_data_saved_);
+ end_time_ = base::Time::Now();
TransitionTo(COMPLETE);
download_manager_->DownloadCompleted(id());
download_stats::RecordDownloadCompleted(start_tick_, received_bytes_);
@@ -683,10 +688,12 @@ DownloadPersistentStoreInfo DownloadItem::GetPersistentStoreInfo() const {
GetURL(),
referrer_url(),
start_time(),
+ end_time(),
received_bytes(),
total_bytes(),
state(),
- db_handle());
+ db_handle(),
+ opened());
}
FilePath DownloadItem::GetTargetFilePath() const {

Powered by Google App Engine
This is Rietveld 408576698