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