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/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "content/browser/download/download_resource_handler.h" | 10 #include "content/browser/download/download_resource_handler.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 for (size_t i = 0; i < arraysize(kMapMimeTypeToDownloadContent); ++i) { | 474 for (size_t i = 0; i < arraysize(kMapMimeTypeToDownloadContent); ++i) { |
475 const MimeTypeToDownloadContent& entry = kMapMimeTypeToDownloadContent[i]; | 475 const MimeTypeToDownloadContent& entry = kMapMimeTypeToDownloadContent[i]; |
476 if (mime_type_string == entry.mime_type) { | 476 if (mime_type_string == entry.mime_type) { |
477 download_content = entry.download_content; | 477 download_content = entry.download_content; |
478 break; | 478 break; |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 // Do partial matches. | 482 // Do partial matches. |
483 if (download_content == DOWNLOAD_CONTENT_UNRECOGNIZED) { | 483 if (download_content == DOWNLOAD_CONTENT_UNRECOGNIZED) { |
484 if (base::StartsWithASCII(mime_type_string, "text/", true)) { | 484 if (base::StartsWith(mime_type_string, "text/", |
| 485 base::CompareCase::SENSITIVE)) { |
485 download_content = DOWNLOAD_CONTENT_TEXT; | 486 download_content = DOWNLOAD_CONTENT_TEXT; |
486 } else if (base::StartsWithASCII(mime_type_string, "image/", true)) { | 487 } else if (base::StartsWith(mime_type_string, "image/", |
| 488 base::CompareCase::SENSITIVE)) { |
487 download_content = DOWNLOAD_CONTENT_IMAGE; | 489 download_content = DOWNLOAD_CONTENT_IMAGE; |
488 RecordDownloadImageType(mime_type_string); | 490 RecordDownloadImageType(mime_type_string); |
489 } else if (base::StartsWithASCII(mime_type_string, "audio/", true)) { | 491 } else if (base::StartsWith(mime_type_string, "audio/", |
| 492 base::CompareCase::SENSITIVE)) { |
490 download_content = DOWNLOAD_CONTENT_AUDIO; | 493 download_content = DOWNLOAD_CONTENT_AUDIO; |
491 } else if (base::StartsWithASCII(mime_type_string, "video/", true)) { | 494 } else if (base::StartsWith(mime_type_string, "video/", |
| 495 base::CompareCase::SENSITIVE)) { |
492 download_content = DOWNLOAD_CONTENT_VIDEO; | 496 download_content = DOWNLOAD_CONTENT_VIDEO; |
493 } | 497 } |
494 } | 498 } |
495 | 499 |
496 // Record the value. | 500 // Record the value. |
497 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", | 501 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", |
498 download_content, | 502 download_content, |
499 DOWNLOAD_CONTENT_MAX); | 503 DOWNLOAD_CONTENT_MAX); |
500 } | 504 } |
501 | 505 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 int state) { | 642 int state) { |
639 if (is_partial) | 643 if (is_partial) |
640 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state, | 644 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state, |
641 ORIGIN_STATE_ON_RESUMPTION_MAX); | 645 ORIGIN_STATE_ON_RESUMPTION_MAX); |
642 else | 646 else |
643 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state, | 647 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state, |
644 ORIGIN_STATE_ON_RESUMPTION_MAX); | 648 ORIGIN_STATE_ON_RESUMPTION_MAX); |
645 } | 649 } |
646 | 650 |
647 } // namespace content | 651 } // namespace content |
OLD | NEW |