| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/metrics/histogram_functions.h" | 8 #include "base/metrics/histogram_functions.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "content/browser/download/download_resource_handler.h" | 12 #include "content/browser/download/download_resource_handler.h" |
| 13 #include "content/public/browser/download_interrupt_reasons.h" | 13 #include "content/public/browser/download_interrupt_reasons.h" |
| 14 #include "net/http/http_content_disposition.h" | 14 #include "net/http/http_content_disposition.h" |
| 15 #include "net/http/http_util.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // All possible error codes from the network module. Note that the error codes | 21 // All possible error codes from the network module. Note that the error codes |
| 21 // are all positive (since histograms expect positive sample values). | 22 // are all positive (since histograms expect positive sample values). |
| 22 const int kAllInterruptReasonCodes[] = { | 23 const int kAllInterruptReasonCodes[] = { |
| 23 #define INTERRUPT_REASON(label, value) (value), | 24 #define INTERRUPT_REASON(label, value) (value), |
| 24 #include "content/public/browser/download_interrupt_reason_values.h" | 25 #include "content/public/browser/download_interrupt_reason_values.h" |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 const base::Optional<ui::PageTransition>& page_transition) { | 926 const base::Optional<ui::PageTransition>& page_transition) { |
| 926 if (!page_transition) | 927 if (!page_transition) |
| 927 return; | 928 return; |
| 928 | 929 |
| 929 UMA_HISTOGRAM_ENUMERATION( | 930 UMA_HISTOGRAM_ENUMERATION( |
| 930 "Download.PageTransition", | 931 "Download.PageTransition", |
| 931 ui::PageTransitionStripQualifier(page_transition.value()), | 932 ui::PageTransitionStripQualifier(page_transition.value()), |
| 932 ui::PAGE_TRANSITION_LAST_CORE + 1); | 933 ui::PAGE_TRANSITION_LAST_CORE + 1); |
| 933 } | 934 } |
| 934 | 935 |
| 936 void RecordDownloadHttpResponseCode(int response_code) { |
| 937 UMA_HISTOGRAM_CUSTOM_ENUMERATION( |
| 938 "Download.HttpResponseCode", |
| 939 net::HttpUtil::MapStatusCodeForHistogram(response_code), |
| 940 net::HttpUtil::GetStatusCodesForHistogram()); |
| 941 } |
| 942 |
| 935 } // namespace content | 943 } // namespace content |
| OLD | NEW |