| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Holds helpers for gathering UMA stats about downloads. | 5 // Holds helpers for gathering UMA stats about downloads. |
| 6 | 6 |
| 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "content/common/content_export.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class TimeTicks; | 17 class TimeTicks; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace download_stats { | 20 namespace download_stats { |
| 20 | 21 |
| 21 // We keep a count of how often various events occur in the | 22 // We keep a count of how often various events occur in the |
| 22 // histogram "Download.Counts". | 23 // histogram "Download.Counts". |
| 23 enum DownloadCountTypes { | 24 enum DownloadCountTypes { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 // Downloads that are started. Should be equal to UNTHROTTLED_COUNT. | 55 // Downloads that are started. Should be equal to UNTHROTTLED_COUNT. |
| 55 START_COUNT, | 56 START_COUNT, |
| 56 | 57 |
| 57 // Downloads that were interrupted by the OS. | 58 // Downloads that were interrupted by the OS. |
| 58 INTERRUPTED_COUNT, | 59 INTERRUPTED_COUNT, |
| 59 | 60 |
| 60 DOWNLOAD_COUNT_TYPES_LAST_ENTRY | 61 DOWNLOAD_COUNT_TYPES_LAST_ENTRY |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 // Increment one of the above counts. | 64 // Increment one of the above counts. |
| 64 void RecordDownloadCount(DownloadCountTypes type); | 65 CONTENT_EXPORT void RecordDownloadCount(DownloadCountTypes type); |
| 65 | 66 |
| 66 // Record COMPLETED_COUNT and how long the download took. | 67 // Record COMPLETED_COUNT and how long the download took. |
| 67 void RecordDownloadCompleted(const base::TimeTicks& start); | 68 void RecordDownloadCompleted(const base::TimeTicks& start); |
| 68 | 69 |
| 69 // Record INTERRUPTED_COUNT, |error|, |received| and |total| bytes. | 70 // Record INTERRUPTED_COUNT, |error|, |received| and |total| bytes. |
| 70 void RecordDownloadInterrupted(int error, int64 received, int64 total); | 71 void RecordDownloadInterrupted(int error, int64 received, int64 total); |
| 71 | 72 |
| 72 // Records the mime type of the download. | 73 // Records the mime type of the download. |
| 73 void RecordDownloadMimeType(const std::string& mime_type); | 74 void RecordDownloadMimeType(const std::string& mime_type); |
| 74 | 75 |
| 75 } // namespace download_stats | 76 } // namespace download_stats |
| 76 | 77 |
| 77 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 78 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |