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 #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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Record the value. | 298 // Record the value. |
299 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", | 299 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", |
300 download_content, | 300 download_content, |
301 DOWNLOAD_CONTENT_MAX); | 301 DOWNLOAD_CONTENT_MAX); |
302 } | 302 } |
303 | 303 |
304 void RecordDownloadContentDisposition( | 304 void RecordDownloadContentDisposition( |
305 const std::string& content_disposition_string) { | 305 const std::string& content_disposition_string) { |
306 if (content_disposition_string.empty()) | 306 if (content_disposition_string.empty()) |
307 return; | 307 return; |
308 net::HttpContentDisposition content_disposition( | 308 net::HttpContentDisposition content_disposition(content_disposition_string, |
309 content_disposition_string, ""); | 309 std::string()); |
310 int result = content_disposition.parse_result_flags(); | 310 int result = content_disposition.parse_result_flags(); |
311 | 311 |
312 bool is_valid = !content_disposition.filename().empty(); | 312 bool is_valid = !content_disposition.filename().empty(); |
313 RecordContentDispositionCount(CONTENT_DISPOSITION_HEADER_PRESENT, true); | 313 RecordContentDispositionCount(CONTENT_DISPOSITION_HEADER_PRESENT, true); |
314 RecordContentDispositionCount(CONTENT_DISPOSITION_IS_VALID, is_valid); | 314 RecordContentDispositionCount(CONTENT_DISPOSITION_IS_VALID, is_valid); |
315 if (!is_valid) | 315 if (!is_valid) |
316 return; | 316 return; |
317 | 317 |
318 RecordContentDispositionCountFlag( | 318 RecordContentDispositionCountFlag( |
319 CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE, result, | 319 CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE, result, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 disk_write_time_ms * 100 / elapsed_time_ms); | 428 disk_write_time_ms * 100 / elapsed_time_ms); |
429 } | 429 } |
430 | 430 |
431 void RecordSavePackageEvent(SavePackageEvent event) { | 431 void RecordSavePackageEvent(SavePackageEvent event) { |
432 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", | 432 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", |
433 event, | 433 event, |
434 SAVE_PACKAGE_LAST_ENTRY); | 434 SAVE_PACKAGE_LAST_ENTRY); |
435 } | 435 } |
436 | 436 |
437 } // namespace content | 437 } // namespace content |
OLD | NEW |