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

Unified Diff: content/browser/download/download_manager.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, 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
Index: content/browser/download/download_manager.cc
diff --git a/content/browser/download/download_manager.cc b/content/browser/download/download_manager.cc
index e3235aea22fd6ecfb8f37603ce14f577d2ef4352..5b140d3d4689f1bb53a56b1e57721ece61bf99e8 100644
--- a/content/browser/download/download_manager.cc
+++ b/content/browser/download/download_manager.cc
@@ -25,6 +25,7 @@
#include "content/browser/download/download_item.h"
#include "content/browser/download/download_manager_delegate.h"
#include "content/browser/download/download_persistent_store_info.h"
+#include "content/browser/download/download_stats.h"
#include "content/browser/download/download_status_updater.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -682,6 +683,7 @@ int DownloadManager::RemoveDownloads(const base::Time remove_begin) {
}
int DownloadManager::RemoveAllDownloads() {
+ download_stats::RecordClearAllSize(history_downloads_.size());
// The null times make the date range unbounded.
return RemoveDownloadsBetween(base::Time(), base::Time());
}
@@ -841,6 +843,8 @@ void DownloadManager::AddDownloadItemToHistory(DownloadItem* download,
// is fixed.
CHECK_NE(DownloadItem::kUninitializedHandle, db_handle);
+ download_stats::RecordHistorySize(history_downloads_.size());
+
DCHECK(download->db_handle() == DownloadItem::kUninitializedHandle);
download->set_db_handle(db_handle);
@@ -1068,3 +1072,14 @@ void DownloadManager::SavePageDownloadFinished(DownloadItem* download) {
Details<DownloadItem>(download));
}
}
+
+void DownloadManager::MarkDownloadOpened(DownloadItem* download) {
+ delegate_->UpdateItemInPersistentStore(download);
+ int num_unopened = 0;
+ for (DownloadMap::iterator it = history_downloads_.begin();
+ it != history_downloads_.end(); ++it) {
+ if (it->second->IsComplete() && !it->second->opened())
+ ++num_unopened;
+ }
+ download_stats::RecordOpensOutstanding(num_unopened);
+}

Powered by Google App Engine
This is Rietveld 408576698