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..03a666c9c6e470c2a01523de5b42c23d6c43e97d 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,22 @@ const NSSize kHoverCloseButtonDefaultSize = { 16, 16 }; |
- (void)hide:(id)sender { |
[self cancelAutoCloseAndRemoveTrackingArea]; |
+ download_stats::RecordShelfSize([downloadItemControllers_ count]); |
+ |
+ int numPending = 0; |
+ NSUInteger i = 0; |
+ while (i < [downloadItemControllers_ count]) { |
+ DownloadItemController* itemController = |
+ [downloadItemControllers_ objectAtIndex:i]; |
+ DownloadItem* download = [itemController download]; |
+ bool isTransferDone = download->IsComplete() || |
+ download->IsCancelled() || |
+ download->IsInterrupted(); |
+ 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. |