net_error_info.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // Copyright (c) 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. #ifndef COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_
  5. #define COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_
  6. namespace error_page {
  7. // Network error page events. Used for UMA statistics and its values must be
  8. // mirrored in NetErrorPageEvents in enums.xml.
  9. enum NetworkErrorPageEvent {
  10. NETWORK_ERROR_PAGE_SHOWN = 0, // Error pages shown.
  11. NETWORK_ERROR_PAGE_RELOAD_BUTTON_SHOWN = 1, // Reload buttons shown.
  12. NETWORK_ERROR_PAGE_RELOAD_BUTTON_CLICKED = 2, // Reload button clicked.
  13. NETWORK_ERROR_PAGE_RELOAD_BUTTON_ERROR = 3, // Reload button clicked
  14. // -> error.
  15. // Obsolete values used for the "Show saved copy" button.
  16. // NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_SHOWN = 4,
  17. // NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_CLICKED = 5,
  18. // NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_ERROR = 6,
  19. NETWORK_ERROR_PAGE_MORE_BUTTON_CLICKED = 7, // More button clicked.
  20. // Obsolete:
  21. // NETWORK_ERROR_PAGE_BROWSER_INITIATED_RELOAD = 8, // Reload from browser.
  22. // Obsolete values used for when "Show saved copy" and "Reload" buttons were
  23. // both shown.
  24. //
  25. // NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN = 9,
  26. // NETWORK_ERROR_PAGE_BOTH_BUTTONS_RELOAD_CLICKED = 10,
  27. // NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN_SAVED_COPY_CLICKED = 11,
  28. NETWORK_ERROR_EASTER_EGG_ACTIVATED = 12, // Easter egg activated.
  29. // Obsolete. No longer experimenting with the label.
  30. // NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_SHOWN = 13,
  31. // NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_CLICKED = 14,
  32. // NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_SHOWN = 15,
  33. // NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_CLICKED = 16,
  34. NETWORK_ERROR_DIAGNOSE_BUTTON_CLICKED = 17, // Diagnose button clicked.
  35. // For the button to show all offline pages.
  36. // Obsolete. No longer showing this.
  37. // NETWORK_ERROR_PAGE_SHOW_OFFLINE_PAGES_BUTTON_SHOWN = 18,
  38. // NETWORK_ERROR_PAGE_SHOW_OFFLINE_PAGES_BUTTON_CLICKED = 19,
  39. // For the button to show offline copy.
  40. // Obsolete. No longer showing this.
  41. // NETWORK_ERROR_PAGE_SHOW_OFFLINE_COPY_BUTTON_SHOWN = 20,
  42. // NETWORK_ERROR_PAGE_SHOW_OFFLINE_COPY_BUTTON_CLICKED = 21,
  43. NETWORK_ERROR_PAGE_DOWNLOAD_BUTTON_SHOWN = 22,
  44. NETWORK_ERROR_PAGE_DOWNLOAD_BUTTON_CLICKED = 23,
  45. // Values for suggested content on the net-error page:
  46. // A list containing at least one item of offline content suggestions was
  47. // shown in the expanded/shown state.
  48. NETWORK_ERROR_PAGE_OFFLINE_SUGGESTIONS_SHOWN = 24,
  49. // An item from the offline content suggestions list was clicked.
  50. NETWORK_ERROR_PAGE_OFFLINE_SUGGESTION_CLICKED = 25,
  51. // A link that opens the downloads page was clicked.
  52. NETWORK_ERROR_PAGE_OFFLINE_DOWNLOADS_PAGE_CLICKED = 26,
  53. // A summary of available offline content was shown.
  54. NETWORK_ERROR_PAGE_OFFLINE_CONTENT_SUMMARY_SHOWN = 27,
  55. // A list containing at least one item of offline content suggestions was
  56. // shown in the collapsed/hidden state.
  57. NETWORK_ERROR_PAGE_OFFLINE_SUGGESTIONS_SHOWN_COLLAPSED = 28,
  58. // The error page was shown because the device is offline (this is the dino
  59. // page).
  60. NETWORK_ERROR_PAGE_OFFLINE_ERROR_SHOWN = 29,
  61. NETWORK_ERROR_PAGE_EVENT_MAX,
  62. };
  63. // The status of a DNS probe.
  64. //
  65. // The DNS_PROBE_FINISHED_* values are used in histograms, so:
  66. // 1. FINISHED_UNKNOWN must remain the first FINISHED_* value.
  67. // 2. FINISHED_* values must not be rearranged relative to FINISHED_UNKNOWN.
  68. // 3. New FINISHED_* values must be inserted at the end.
  69. // 4. New non-FINISHED_* values cannot be inserted.
  70. enum DnsProbeStatus {
  71. // A DNS probe may be run for this error page. (This status is only used on
  72. // the renderer side before it's received a status update from the browser.)
  73. DNS_PROBE_POSSIBLE,
  74. // A DNS probe will not be run for this error page. (This happens if the
  75. // user has the "Use web service to resolve navigation errors" preference
  76. // turned off, or if probes are disabled by the field trial.)
  77. DNS_PROBE_NOT_RUN,
  78. // A DNS probe has been started for this error page. The renderer should
  79. // expect to receive another IPC with one of the FINISHED statuses once the
  80. // probe has finished (as long as the error page is still loaded).
  81. DNS_PROBE_STARTED,
  82. // A DNS probe has finished with one of the following results:
  83. // The probe was inconclusive.
  84. DNS_PROBE_FINISHED_INCONCLUSIVE,
  85. // There's no internet connection.
  86. DNS_PROBE_FINISHED_NO_INTERNET,
  87. // The DNS configuration is wrong, or the servers are down or broken.
  88. DNS_PROBE_FINISHED_BAD_CONFIG,
  89. // The DNS servers are working fine, so the domain must not exist.
  90. DNS_PROBE_FINISHED_NXDOMAIN,
  91. // The secure DNS configuration is wrong, or the servers are down or broken.
  92. DNS_PROBE_FINISHED_BAD_SECURE_CONFIG,
  93. DNS_PROBE_MAX
  94. };
  95. // Returns a string representing |status|. It should be simply the name of
  96. // the value as a string, but don't rely on that. This is presented to the
  97. // user as part of the DNS error page (as the error code, at the bottom),
  98. // and is also used in some verbose log messages.
  99. //
  100. // The function will NOTREACHED() and return an empty string if given an int
  101. // that does not match a value in DnsProbeStatus (or if it is DNS_PROBE_MAX,
  102. // which is not a real status).
  103. const char* DnsProbeStatusToString(int status);
  104. // Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses.
  105. bool DnsProbeStatusIsFinished(DnsProbeStatus status);
  106. // Record specific error page events.
  107. void RecordEvent(NetworkErrorPageEvent event);
  108. } // namespace error_page
  109. #endif // COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_