chromium/components/error_page/common/net_error_info.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_
#define COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_

namespace error_page {

// Network error page events.  Used for UMA statistics and its values must be
// mirrored in NetErrorPageEvents in enums.xml.
enum NetworkErrorPageEvent {};

// The status of a DNS probe.
//
// The DNS_PROBE_FINISHED_* values are used in histograms, so:
// 1. FINISHED_UNKNOWN must remain the first FINISHED_* value.
// 2. FINISHED_* values must not be rearranged relative to FINISHED_UNKNOWN.
// 3. New FINISHED_* values must be inserted at the end.
// 4. New non-FINISHED_* values cannot be inserted.
enum DnsProbeStatus {};

// Returns a string representing |status|.  It should be simply the name of
// the value as a string, but don't rely on that.  This is presented to the
// user as part of the DNS error page (as the error code, at the bottom),
// and is also used in some verbose log messages.
//
// The function will NOTREACHED() and return an empty string if given an int
// that does not match a value in DnsProbeStatus (or if it is DNS_PROBE_MAX,
// which is not a real status).
const char* DnsProbeStatusToString(int status);

// Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses.
bool DnsProbeStatusIsFinished(DnsProbeStatus status);

// Record specific error page events.
void RecordEvent(NetworkErrorPageEvent event);

}  // namespace error_page

#endif  // COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_