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

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: merge Created 9 years, 2 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
« no previous file with comments | « content/browser/download/download_item.h ('k') | content/browser/download/download_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item.cc
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index 6a6301fc261becdd55c280169d8fd9205c969922..4ffe6c7ce95ff4dc654c10a44dc77b6960b0a835 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -130,6 +130,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),
@@ -140,7 +141,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())
@@ -285,8 +286,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.
@@ -390,6 +393,7 @@ void DownloadItem::MarkAsComplete() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(all_data_saved_);
+ end_time_ = base::Time::Now();
TransitionTo(COMPLETE);
}
@@ -420,6 +424,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_);
@@ -688,10 +693,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 {
« no previous file with comments | « content/browser/download/download_item.h ('k') | content/browser/download/download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698