Stack sampling profiler: add fire-and-forget interface
[chromium-blink-merge.git] / components / error_page / common / net_error_info.h
blob39b6aaedd32d0432a8bdd1f499e57c8139c49af9
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.
5 #ifndef COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_
6 #define COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_
8 // TODO(hashimoto): Change this to namespace error_page.
9 namespace chrome_common_net {
11 // Network error page events. Used for UMA statistics.
12 enum NetworkErrorPageEvent {
13 NETWORK_ERROR_PAGE_SHOWN = 0, // Error pages shown.
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.
20 // Same 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,
25 NETWORK_ERROR_PAGE_MORE_BUTTON_CLICKED = 7, // More button clicked.
27 NETWORK_ERROR_PAGE_BROWSER_INITIATED_RELOAD = 8, // Reload from browser.
29 // Keep track of which button the user chooses when both are shown.
30 NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN = 9,
31 NETWORK_ERROR_PAGE_BOTH_BUTTONS_RELOAD_CLICKED = 10,
32 NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN_SAVED_COPY_CLICKED = 11,
34 NETWORK_ERROR_EASTER_EGG_ACTIVATED = 12, // Easter egg activated.
36 // For "Google cached copy" label experiment button.
37 NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_SHOWN = 13,
38 NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_CLICKED = 14,
39 NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_SHOWN = 15,
40 NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_CLICKED = 16,
42 NETWORK_ERROR_PAGE_EVENT_MAX = 17,
45 // The status of a DNS probe.
47 // The DNS_PROBE_FINISHED_* values are used in histograms, so:
48 // 1. FINISHED_UNKNOWN must remain the first FINISHED_* value.
49 // 2. FINISHED_* values must not be rearranged relative to FINISHED_UNKNOWN.
50 // 3. New FINISHED_* values must be inserted at the end.
51 // 4. New non-FINISHED_* values cannot be inserted.
52 enum DnsProbeStatus {
53 // A DNS probe may be run for this error page. (This status is only used on
54 // the renderer side before it's received a status update from the browser.)
55 DNS_PROBE_POSSIBLE,
57 // A DNS probe will not be run for this error page. (This happens if the
58 // user has the "Use web service to resolve navigation errors" preference
59 // turned off, or if probes are disabled by the field trial.)
60 DNS_PROBE_NOT_RUN,
62 // A DNS probe has been started for this error page. The renderer should
63 // expect to receive another IPC with one of the FINISHED statuses once the
64 // probe has finished (as long as the error page is still loaded).
65 DNS_PROBE_STARTED,
67 // A DNS probe has finished with one of the following results:
69 // The probe was inconclusive.
70 DNS_PROBE_FINISHED_INCONCLUSIVE,
72 // There's no internet connection.
73 DNS_PROBE_FINISHED_NO_INTERNET,
75 // The DNS configuration is wrong, or the servers are down or broken.
76 DNS_PROBE_FINISHED_BAD_CONFIG,
78 // The DNS servers are working fine, so the domain must not exist.
79 DNS_PROBE_FINISHED_NXDOMAIN,
81 DNS_PROBE_MAX
84 // Returns a string representing |status|. It should be simply the name of
85 // the value as a string, but don't rely on that. This is presented to the
86 // user as part of the DNS error page (as the error code, at the bottom),
87 // and is also used in some verbose log messages.
89 // The function will NOTREACHED() and return an empty string if given an int
90 // that does not match a value in DnsProbeStatus (or if it is DNS_PROBE_MAX,
91 // which is not a real status).
92 const char* DnsProbeStatusToString(int status);
94 // Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses.
95 bool DnsProbeStatusIsFinished(DnsProbeStatus status);
97 // Record specific error page events.
98 void RecordEvent(NetworkErrorPageEvent event);
100 // The error domain used to pass DNS probe statuses to the localized error
101 // code.
102 extern const char kDnsProbeErrorDomain[];
104 } // namespace chrome_common_net
106 #endif // COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_