| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_NET_NET_ERROR_INFO_H_ | 5 #ifndef COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_ |
| 6 #define CHROME_COMMON_NET_NET_ERROR_INFO_H_ | 6 #define COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_ |
| 7 | 7 |
| 8 // TODO(hashimoto): Change this to namespace error_page. |
| 8 namespace chrome_common_net { | 9 namespace chrome_common_net { |
| 9 | 10 |
| 10 // Network error page events. Used for UMA statistics. | 11 // Network error page events. Used for UMA statistics. |
| 11 enum NetworkErrorPageEvent { | 12 enum NetworkErrorPageEvent { |
| 12 NETWORK_ERROR_PAGE_SHOWN, // Error pages shown. | 13 NETWORK_ERROR_PAGE_SHOWN, // Error pages shown. |
| 13 | 14 |
| 14 NETWORK_ERROR_PAGE_RELOAD_BUTTON_SHOWN, // Reload buttons shown. | 15 NETWORK_ERROR_PAGE_RELOAD_BUTTON_SHOWN, // Reload buttons shown. |
| 15 NETWORK_ERROR_PAGE_RELOAD_BUTTON_CLICKED, // Reload button clicked. | 16 NETWORK_ERROR_PAGE_RELOAD_BUTTON_CLICKED, // Reload button clicked. |
| 16 NETWORK_ERROR_PAGE_RELOAD_BUTTON_ERROR, // Reload button clicked | 17 NETWORK_ERROR_PAGE_RELOAD_BUTTON_ERROR, // Reload button clicked |
| 17 // -> error. | 18 // -> error. |
| 18 | 19 |
| 19 NETWORK_ERROR_PAGE_LOAD_STALE_BUTTON_SHOWN, // Load stale buttons shown. | 20 NETWORK_ERROR_PAGE_LOAD_STALE_BUTTON_SHOWN, // Load stale buttons shown. |
| 20 NETWORK_ERROR_PAGE_LOAD_STALE_BUTTON_CLICKED, // Load stale button clicked. | 21 NETWORK_ERROR_PAGE_LOAD_STALE_BUTTON_CLICKED, // Load stale button clicked. |
| 21 NETWORK_ERROR_PAGE_LOAD_STALE_BUTTON_ERROR, // Load stale buttons -> error. | 22 NETWORK_ERROR_PAGE_LOAD_STALE_BUTTON_ERROR, // Load stale buttons -> error. |
| 22 | 23 |
| 23 NETWORK_ERROR_PAGE_MORE_BUTTON_CLICKED, // More button clicked. | 24 NETWORK_ERROR_PAGE_MORE_BUTTON_CLICKED, // More button clicked. |
| 24 | 25 |
| 25 NETWORK_ERROR_PAGE_BROWSER_INITIATED_RELOAD, // Reload from browser. | 26 NETWORK_ERROR_PAGE_BROWSER_INITIATED_RELOAD, // Reload from browser. |
| 26 | 27 |
| 27 NETWORK_ERROR_PAGE_EVENT_MAX, | 28 NETWORK_ERROR_PAGE_EVENT_MAX, |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 // The status of a DNS probe that the NetErrorTabHelper may or may not have | 31 // The status of a DNS probe. |
| 31 // started. | |
| 32 // | 32 // |
| 33 // The DNS_PROBE_FINISHED_* values are used in histograms, so: | 33 // The DNS_PROBE_FINISHED_* values are used in histograms, so: |
| 34 // 1. FINISHED_UNKNOWN must remain the first FINISHED_* value. | 34 // 1. FINISHED_UNKNOWN must remain the first FINISHED_* value. |
| 35 // 2. FINISHED_* values must not be rearranged relative to FINISHED_UNKNOWN. | 35 // 2. FINISHED_* values must not be rearranged relative to FINISHED_UNKNOWN. |
| 36 // 3. New FINISHED_* values must be inserted at the end. | 36 // 3. New FINISHED_* values must be inserted at the end. |
| 37 // 4. New non-FINISHED_* values cannot be inserted. | 37 // 4. New non-FINISHED_* values cannot be inserted. |
| 38 enum DnsProbeStatus { | 38 enum DnsProbeStatus { |
| 39 // A DNS probe may be run for this error page. (This status is only used on | 39 // A DNS probe may be run for this error page. (This status is only used on |
| 40 // the renderer side before it's received a status update from the browser.) | 40 // the renderer side before it's received a status update from the browser.) |
| 41 DNS_PROBE_POSSIBLE, | 41 DNS_PROBE_POSSIBLE, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 65 DNS_PROBE_FINISHED_NXDOMAIN, | 65 DNS_PROBE_FINISHED_NXDOMAIN, |
| 66 | 66 |
| 67 DNS_PROBE_MAX | 67 DNS_PROBE_MAX |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Returns a string representing |status|. It should be simply the name of | 70 // Returns a string representing |status|. It should be simply the name of |
| 71 // the value as a string, but don't rely on that. This is presented to the | 71 // the value as a string, but don't rely on that. This is presented to the |
| 72 // user as part of the DNS error page (as the error code, at the bottom), | 72 // user as part of the DNS error page (as the error code, at the bottom), |
| 73 // and is also used in some verbose log messages. | 73 // and is also used in some verbose log messages. |
| 74 // | 74 // |
| 75 // |status| is an int because error codes are ints by the time they get to the | 75 // The function will NOTREACHED() and return an empty string if given an int |
| 76 // localized error system, and we don't want to require the caller to cast back | 76 // that does not match a value in DnsProbeStatus (or if it is DNS_PROBE_MAX, |
| 77 // to a probe status. The function will NOTREACHED() and return an empty | 77 // which is not a real status). |
| 78 // string if given an int that does not match a value in DnsProbeStatus (or if | |
| 79 // it is DNS_PROBE_MAX, which is not a real status). | |
| 80 const char* DnsProbeStatusToString(int status); | 78 const char* DnsProbeStatusToString(int status); |
| 81 | 79 |
| 82 // Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses. | 80 // Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses. |
| 83 bool DnsProbeStatusIsFinished(DnsProbeStatus status); | 81 bool DnsProbeStatusIsFinished(DnsProbeStatus status); |
| 84 | 82 |
| 85 // Record specific error page events. | 83 // Record specific error page events. |
| 86 void RecordEvent(NetworkErrorPageEvent event); | 84 void RecordEvent(NetworkErrorPageEvent event); |
| 87 | 85 |
| 88 // The error domain used to pass DNS probe statuses to the localized error | 86 // The error domain used to pass DNS probe statuses to the localized error |
| 89 // code. | 87 // code. |
| 90 extern const char kDnsProbeErrorDomain[]; | 88 extern const char kDnsProbeErrorDomain[]; |
| 91 | 89 |
| 92 } // namespace chrome_common_net | 90 } // namespace chrome_common_net |
| 93 | 91 |
| 94 #endif // CHROME_COMMON_NET_NET_ERROR_INFO_H_ | 92 #endif // COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_ |
| OLD | NEW |