• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/logging.h"
6 #include "base/metrics/histogram.h"
7 #include "chrome/common/net/net_error_info.h"
8 
9 namespace chrome_common_net {
10 
11 const char kDnsProbeErrorDomain[] = "dnsprobe";
12 
DnsProbeStatusToString(int status)13 const char* DnsProbeStatusToString(int status) {
14   switch (status) {
15   case DNS_PROBE_POSSIBLE:
16     return "DNS_PROBE_POSSIBLE";
17   case DNS_PROBE_NOT_RUN:
18     return "DNS_PROBE_NOT_RUN";
19   case DNS_PROBE_STARTED:
20     return "DNS_PROBE_STARTED";
21   case DNS_PROBE_FINISHED_INCONCLUSIVE:
22     return "DNS_PROBE_FINISHED_INCONCLUSIVE";
23   case DNS_PROBE_FINISHED_NO_INTERNET:
24     return "DNS_PROBE_FINISHED_NO_INTERNET";
25   case DNS_PROBE_FINISHED_BAD_CONFIG:
26     return "DNS_PROBE_FINISHED_BAD_CONFIG";
27   case DNS_PROBE_FINISHED_NXDOMAIN:
28     return "DNS_PROBE_FINISHED_NXDOMAIN";
29   default:
30     NOTREACHED();
31     return "";
32   }
33 }
34 
DnsProbeStatusIsFinished(DnsProbeStatus status)35 bool DnsProbeStatusIsFinished(DnsProbeStatus status) {
36   return status >= DNS_PROBE_FINISHED_INCONCLUSIVE &&
37          status < DNS_PROBE_MAX;
38 }
39 
RecordEvent(NetworkErrorPageEvent event)40 void RecordEvent(NetworkErrorPageEvent event) {
41   UMA_HISTOGRAM_ENUMERATION("Net.ErrorPageCounts", event,
42                             NETWORK_ERROR_PAGE_EVENT_MAX);
43 }
44 
45 }  // namespace chrome_common_net
46