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

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

Issue 2862743002: Add a metric to record http response code for download requests. (Closed)
Patch Set: Fix an issue for tests, some tests don't have response headers. Created 3 years, 7 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
« no previous file with comments | « content/browser/download/download_stats.h ('k') | tools/metrics/histograms/histograms.xml » ('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/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
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
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698