| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/download_danger_type.h" |
| 14 #include "content/public/browser/download_interrupt_reasons.h" | 15 #include "content/public/browser/download_interrupt_reasons.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class Time; | 18 class Time; |
| 18 class TimeDelta; | 19 class TimeDelta; |
| 19 class TimeTicks; | 20 class TimeTicks; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 INITIATED_BY_RENDERER, | 86 INITIATED_BY_RENDERER, |
| 86 | 87 |
| 87 // The download was initiated by a renderer or plugin process through | 88 // The download was initiated by a renderer or plugin process through |
| 88 // the IPC ViewHostMsg_SaveURLAs; currently this is only used by the | 89 // the IPC ViewHostMsg_SaveURLAs; currently this is only used by the |
| 89 // Pepper plugin API. | 90 // Pepper plugin API. |
| 90 INITIATED_BY_PEPPER_SAVE, | 91 INITIATED_BY_PEPPER_SAVE, |
| 91 | 92 |
| 92 DOWNLOAD_SOURCE_LAST_ENTRY | 93 DOWNLOAD_SOURCE_LAST_ENTRY |
| 93 }; | 94 }; |
| 94 | 95 |
| 96 enum DownloadDiscardReason { |
| 97 // The download is being discarded due to a user action. |
| 98 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION, |
| 99 |
| 100 // The download is being discarded due to the browser being shut down. |
| 101 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN |
| 102 }; |
| 103 |
| 95 // Increment one of the above counts. | 104 // Increment one of the above counts. |
| 96 void RecordDownloadCount(DownloadCountTypes type); | 105 void RecordDownloadCount(DownloadCountTypes type); |
| 97 | 106 |
| 98 // Record initiation of a download from a specific source. | 107 // Record initiation of a download from a specific source. |
| 99 void RecordDownloadSource(DownloadSource source); | 108 void RecordDownloadSource(DownloadSource source); |
| 100 | 109 |
| 101 // Record COMPLETED_COUNT and how long the download took. | 110 // Record COMPLETED_COUNT and how long the download took. |
| 102 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len); | 111 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len); |
| 103 | 112 |
| 104 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. | 113 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. |
| 105 void RecordDownloadInterrupted(DownloadInterruptReason reason, | 114 void RecordDownloadInterrupted(DownloadInterruptReason reason, |
| 106 int64 received, | 115 int64 received, |
| 107 int64 total); | 116 int64 total); |
| 108 | 117 |
| 118 // Record a dangerous download accept event. |
| 119 void RecordDangerousDownloadAccept(DownloadDangerType danger_type); |
| 120 |
| 121 // Record a dangerous download discard event. |
| 122 void RecordDangerousDownloadDiscard(DownloadDiscardReason reason, |
| 123 DownloadDangerType danger_type); |
| 124 |
| 109 // Records the mime type of the download. | 125 // Records the mime type of the download. |
| 110 void RecordDownloadMimeType(const std::string& mime_type); | 126 void RecordDownloadMimeType(const std::string& mime_type); |
| 111 | 127 |
| 112 // Records usage of Content-Disposition header. | 128 // Records usage of Content-Disposition header. |
| 113 void RecordDownloadContentDisposition(const std::string& content_disposition); | 129 void RecordDownloadContentDisposition(const std::string& content_disposition); |
| 114 | 130 |
| 115 // Record WRITE_SIZE_COUNT and data_len. | 131 // Record WRITE_SIZE_COUNT and data_len. |
| 116 void RecordDownloadWriteSize(size_t data_len); | 132 void RecordDownloadWriteSize(size_t data_len); |
| 117 | 133 |
| 118 // Record WRITE_LOOP_COUNT and number of loops. | 134 // Record WRITE_LOOP_COUNT and number of loops. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 SAVE_PACKAGE_WRITE_TO_FAILED, | 186 SAVE_PACKAGE_WRITE_TO_FAILED, |
| 171 | 187 |
| 172 SAVE_PACKAGE_LAST_ENTRY | 188 SAVE_PACKAGE_LAST_ENTRY |
| 173 }; | 189 }; |
| 174 | 190 |
| 175 void RecordSavePackageEvent(SavePackageEvent event); | 191 void RecordSavePackageEvent(SavePackageEvent event); |
| 176 | 192 |
| 177 } // namespace content | 193 } // namespace content |
| 178 | 194 |
| 179 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 195 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |