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

Unified Diff: chrome/browser/ui/cocoa/download/download_shelf_controller.mm

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: fixed tests 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: chrome/browser/ui/cocoa/download/download_shelf_controller.mm
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
index fb69b913340d9eaddedf312fc7cb97566db84aa4..15d88c7febabeff9b042aab356db288b38e5689c 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
+++ b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
@@ -20,6 +20,7 @@
#import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
#include "content/browser/download/download_item.h"
#include "content/browser/download/download_manager.h"
+#include "content/browser/download/download_stats.h"
#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
#include "ui/base/l10n/l10n_util.h"
@@ -240,6 +241,21 @@ const NSSize kHoverCloseButtonDefaultSize = { 16, 16 };
- (void)hide:(id)sender {
[self cancelAutoCloseAndRemoveTrackingArea];
+ download_stats::RecordShelfSize([downloadItemControllers_ count]);
Randy Smith (Not in Mondays) 2011/09/30 15:57:21 I believe that on some platforms, but not others,
benjhayden 2011/10/03 20:54:39 I went ahead and split the stat.
+
+ int numPending = 0;
+ for (NSUInteger i = 0; i < [downloadItemControllers_ count]; ++i) {
+ DownloadItemController* itemController =
+ [downloadItemControllers_ objectAtIndex:i];
+ DownloadItem* download = [itemController download];
+ bool isTransferDone = download->IsComplete() ||
+ download->IsCancelled() ||
+ download->IsInterrupted();
Randy Smith (Not in Mondays) 2011/09/30 15:57:21 Is there a reason we're not just counting number i
benjhayden 2011/10/03 20:54:39 Done.
+ if (!isTransferDone)
+ ++numPending;
+ }
+ download_stats::RecordShelfPendingSize(numPending);
+
// If |sender| isn't nil, then we're being closed from the UI by the user and
// we need to tell our shelf implementation to close. Otherwise, we're being
// closed programmatically by our shelf implementation.

Powered by Google App Engine
This is Rietveld 408576698