12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef CHROME_COMMON_NET_NET_ERROR_INFO_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define CHROME_COMMON_NET_NET_ERROR_INFO_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace chrome_common_net { 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 107dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// The status of a DNS probe that the NetErrorTabHelper may or may not have 117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// started. 127dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// 137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// The DNS_PROBE_FINISHED_* values are used in histograms, so: 147dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// 1. FINISHED_UNKNOWN must remain the first FINISHED_* value. 157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// 2. FINISHED_* values must not be rearranged relative to FINISHED_UNKNOWN. 167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// 3. New FINISHED_* values must be inserted at the end. 17a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// 4. New non-FINISHED_* values cannot be inserted. 187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochenum DnsProbeStatus { 197dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // A DNS probe may be run for this error page. (This status is only used on 207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // the renderer side before it's received a status update from the browser.) 217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_POSSIBLE, 227dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 237dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // A DNS probe will not be run for this error page. (This happens if the 247dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // user has the "Use web service to resolve navigation errors" preference 257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // turned off, or if probes are disabled by the field trial.) 267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_NOT_RUN, 277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // A DNS probe has been started for this error page. The renderer should 297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // expect to receive another IPC with one of the FINISHED statuses once the 307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // probe has finished (as long as the error page is still loaded). 317dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_STARTED, 327dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 337dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // A DNS probe has finished with one of the following results: 347dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 357dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The probe was inconclusive. 367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_FINISHED_INCONCLUSIVE, 377dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 387dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // There's no internet connection. 397dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_FINISHED_NO_INTERNET, 407dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 417dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The DNS configuration is wrong, or the servers are down or broken. 427dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_FINISHED_BAD_CONFIG, 437dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 447dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The DNS servers are working fine, so the domain must not exist. 457dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch DNS_PROBE_FINISHED_NXDOMAIN, 467dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DNS_PROBE_MAX 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 507dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Returns a string representing |status|. It should be simply the name of 517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// the value as a string, but don't rely on that. This is presented to the 527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// user as part of the DNS error page (as the error code, at the bottom), 537dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// and is also used in some verbose log messages. 547dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// 557dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// |status| is an int because error codes are ints by the time they get to the 567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// localized error system, and we don't want to require the caller to cast back 577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// to a probe status. The function will NOTREACHED() and return an empty 587dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// string if given an int that does not match a value in DnsProbeStatus (or if 597dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// it is DNS_PROBE_MAX, which is not a real status). 607dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochconst char* DnsProbeStatusToString(int status); 617dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 627dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses. 637dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochbool DnsProbeStatusIsFinished(DnsProbeStatus status); 647dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 657dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// The error domain used to pass DNS probe statuses to the localized error 667dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// code. 677dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochextern const char kDnsProbeErrorDomain[]; 687dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace chrome_common_net 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // CHROME_COMMON_NET_NET_ERROR_INFO_H_ 72