Automated Commit: Committing new LKGM version 6953.0.0 for chromeos.
[chromium-blink-merge.git] / components / error_page / common / net_error_info.cc
blobd47e7e59095a933bd1a5cad3bae4de3aa622cb44
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.
5 #include "components/error_page/common/net_error_info.h"
7 #include "base/logging.h"
8 #include "base/metrics/histogram.h"
10 namespace chrome_common_net {
12 const char kDnsProbeErrorDomain[] = "dnsprobe";
14 const char* DnsProbeStatusToString(int status) {
15 switch (status) {
16 case DNS_PROBE_POSSIBLE:
17 return "DNS_PROBE_POSSIBLE";
18 case DNS_PROBE_NOT_RUN:
19 return "DNS_PROBE_NOT_RUN";
20 case DNS_PROBE_STARTED:
21 return "DNS_PROBE_STARTED";
22 case DNS_PROBE_FINISHED_INCONCLUSIVE:
23 return "DNS_PROBE_FINISHED_INCONCLUSIVE";
24 case DNS_PROBE_FINISHED_NO_INTERNET:
25 return "DNS_PROBE_FINISHED_NO_INTERNET";
26 case DNS_PROBE_FINISHED_BAD_CONFIG:
27 return "DNS_PROBE_FINISHED_BAD_CONFIG";
28 case DNS_PROBE_FINISHED_NXDOMAIN:
29 return "DNS_PROBE_FINISHED_NXDOMAIN";
30 default:
31 NOTREACHED();
32 return "";
36 bool DnsProbeStatusIsFinished(DnsProbeStatus status) {
37 return status >= DNS_PROBE_FINISHED_INCONCLUSIVE &&
38 status < DNS_PROBE_MAX;
41 void RecordEvent(NetworkErrorPageEvent event) {
42 UMA_HISTOGRAM_ENUMERATION("Net.ErrorPageCounts", event,
43 NETWORK_ERROR_PAGE_EVENT_MAX);
46 } // namespace chrome_common_net