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

Unified Diff: content/browser/download/download_stats.h

Issue 7664019: Move download UMA functions to their own file in content. Also fire the chrome-only notification ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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_resource_handler.cc ('k') | content/browser/download/download_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_stats.h
===================================================================
--- content/browser/download/download_stats.h (revision 0)
+++ content/browser/download/download_stats.h (revision 0)
@@ -0,0 +1,77 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Holds helpers for gathering UMA stats about downloads.
+
+#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
+#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+
+namespace base {
+class TimeTicks;
+}
+
+namespace download_stats {
+
+// We keep a count of how often various events occur in the
+// histogram "Download.Counts".
+enum DownloadCountTypes {
+ // The download was initiated by navigating to a URL (e.g. by user
+ // click).
+ INITIATED_BY_NAVIGATION_COUNT = 0,
+
+ // The download was initiated by invoking a context menu within a page.
+ INITIATED_BY_CONTEXT_MENU_COUNT,
+
+ // The download was initiated when the SavePackage system rejected
+ // a Save Page As ... by returning false from
+ // SavePackage::IsSaveableContents().
+ INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT,
+
+ // The download was initiated by a drag and drop from a drag-and-drop
+ // enabled web application.
+ INITIATED_BY_DRAG_N_DROP_COUNT,
+
+ // The download was initiated by explicit RPC from the renderer process
+ // (e.g. by Alt-click).
+ INITIATED_BY_RENDERER_COUNT,
+
+ // Downloads that made it to DownloadResourceHandler -- all of the
+ // above minus those blocked by DownloadThrottlingResourceHandler.
+ UNTHROTTLED_COUNT,
+
+ // Downloads that actually complete.
+ COMPLETED_COUNT,
+
+ // Downloads that are cancelled before completion (user action or error).
+ CANCELLED_COUNT,
+
+ // Downloads that are started. Should be equal to UNTHROTTLED_COUNT.
+ START_COUNT,
+
+ // Downloads that were interrupted by the OS.
+ INTERRUPTED_COUNT,
+
+ DOWNLOAD_COUNT_TYPES_LAST_ENTRY
+};
+
+// Increment one of the above counts.
+void RecordDownloadCount(DownloadCountTypes type);
+
+// Record COMPLETED_COUNT and how long the download took.
+void RecordDownloadCompleted(const base::TimeTicks& start);
+
+// Record INTERRUPTED_COUNT, |error|, |received| and |total| bytes.
+void RecordDownloadInterrupted(int error, int64 received, int64 total);
+
+// Records the mime type of the download.
+void RecordDownloadMimeType(const std::string& mime_type);
+
+} // namespace download_util
Paweł Hajdan Jr. 2011/08/16 23:36:13 nit: download_stats
jam 2011/08/16 23:44:40 Done.
+
+#endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
Property changes on: content\browser\download\download_stats.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « content/browser/download/download_resource_handler.cc ('k') | content/browser/download/download_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698