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

Side by Side Diff: content/browser/download/download_stats.cc

Issue 14947007: [Downloads] Allow acquiring dangerous download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/public/browser/download_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/browser/download/download_stats.h" 5 #include "content/browser/download/download_stats.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "content/browser/download/download_resource_handler.h" 9 #include "content/browser/download/download_resource_handler.h"
10 #include "content/public/browser/download_interrupt_reasons.h" 10 #include "content/public/browser/download_interrupt_reasons.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 -delta_bytes, 138 -delta_bytes,
139 1, 139 1,
140 kMaxKb, 140 kMaxKb,
141 kBuckets); 141 kBuckets);
142 } 142 }
143 } 143 }
144 144
145 UMA_HISTOGRAM_BOOLEAN("Download.InterruptedUnknownSize", unknown_size); 145 UMA_HISTOGRAM_BOOLEAN("Download.InterruptedUnknownSize", unknown_size);
146 } 146 }
147 147
148 void RecordDangerousDownloadAccept(DownloadDangerType danger_type) {
149 UMA_HISTOGRAM_ENUMERATION("Download.DangerousDownloadValidated",
150 danger_type,
151 DOWNLOAD_DANGER_TYPE_MAX);
152 }
153
154 void RecordDangerousDownloadDiscard(DownloadDiscardReason reason,
155 DownloadDangerType danger_type) {
156 switch (reason) {
157 case DOWNLOAD_DISCARD_DUE_TO_USER_ACTION:
158 UMA_HISTOGRAM_ENUMERATION(
159 "Download.UserDiscard", danger_type, DOWNLOAD_DANGER_TYPE_MAX);
160 break;
161 case DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN:
162 UMA_HISTOGRAM_ENUMERATION(
163 "Download.Discard", danger_type, DOWNLOAD_DANGER_TYPE_MAX);
164 break;
165 default:
166 NOTREACHED();
167 }
168 }
169
148 void RecordDownloadWriteSize(size_t data_len) { 170 void RecordDownloadWriteSize(size_t data_len) {
149 RecordDownloadCount(WRITE_SIZE_COUNT); 171 RecordDownloadCount(WRITE_SIZE_COUNT);
150 int max = 1024 * 1024; // One Megabyte. 172 int max = 1024 * 1024; // One Megabyte.
151 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.WriteSize", data_len, 1, max, 256); 173 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.WriteSize", data_len, 1, max, 256);
152 } 174 }
153 175
154 void RecordDownloadWriteLoopCount(int count) { 176 void RecordDownloadWriteLoopCount(int count) {
155 RecordDownloadCount(WRITE_LOOP_COUNT); 177 RecordDownloadCount(WRITE_LOOP_COUNT);
156 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20); 178 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20);
157 } 179 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 disk_write_time_ms * 100 / elapsed_time_ms); 450 disk_write_time_ms * 100 / elapsed_time_ms);
429 } 451 }
430 452
431 void RecordSavePackageEvent(SavePackageEvent event) { 453 void RecordSavePackageEvent(SavePackageEvent event) {
432 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", 454 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
433 event, 455 event,
434 SAVE_PACKAGE_LAST_ENTRY); 456 SAVE_PACKAGE_LAST_ENTRY);
435 } 457 }
436 458
437 } // namespace content 459 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/public/browser/download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698