OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 5 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // System clock is behind. | 40 // System clock is behind. |
41 CLOCK_STATE_PAST, | 41 CLOCK_STATE_PAST, |
42 | 42 |
43 // System clock is ahead. | 43 // System clock is ahead. |
44 CLOCK_STATE_FUTURE, | 44 CLOCK_STATE_FUTURE, |
45 | 45 |
46 CLOCK_STATE_MAX, | 46 CLOCK_STATE_MAX, |
47 }; | 47 }; |
48 | 48 |
| 49 // Describes the result of getting network time and if it was |
| 50 // unavailable, why it was unavailable. This enum is being histogrammed |
| 51 // so do not reorder or remove values. |
| 52 // |
| 53 // Exposed for testing. |
| 54 enum NetworkClockState { |
| 55 // Value 0 was NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC, which is obsolete |
| 56 // in favor of the finer-grained values below. |
| 57 |
| 58 // The clock state relative to network time is unknown because the |
| 59 // user's clock has fallen out of sync with the latest information |
| 60 // from the network (due to e.g. suspend/resume). |
| 61 NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST = 1, |
| 62 // The clock is "close enough" to the network time. |
| 63 NETWORK_CLOCK_STATE_OK, |
| 64 // The clock is in the past relative to network time. |
| 65 NETWORK_CLOCK_STATE_CLOCK_IN_PAST, |
| 66 // The clock is in the future relative to network time. |
| 67 NETWORK_CLOCK_STATE_CLOCK_IN_FUTURE, |
| 68 // The clock state relative to network time is unknown because no sync |
| 69 // attempt has been made yet. |
| 70 NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT, |
| 71 // The clock state relative to network time is unknown because one or |
| 72 // more sync attempts has failed. |
| 73 NETWORK_CLOCK_STATE_UNKNOWN_NO_SUCCESSFUL_SYNC, |
| 74 // The clock state relative to network time is unknown because the |
| 75 // first sync attempt is still pending. |
| 76 NETWORK_CLOCK_STATE_UNKNOWN_FIRST_SYNC_PENDING, |
| 77 // The clock state relative to network time is unknown because one or |
| 78 // more time query attempts have failed, and a subsequent sync attempt |
| 79 // is still pending. |
| 80 NETWORK_CLOCK_STATE_UNKNOWN_SUBSEQUENT_SYNC_PENDING, |
| 81 NETWORK_CLOCK_STATE_MAX |
| 82 }; |
| 83 |
49 // Compares |now_system| to the build time and to the current network time, and | 84 // Compares |now_system| to the build time and to the current network time, and |
50 // returns an inference about the state of the system clock. A result from | 85 // returns an inference about the state of the system clock. A result from |
51 // network time, if available, will always be preferred to a result from the | 86 // network time, if available, will always be preferred to a result from the |
52 // build time. Calling this function records UMA statistics: it's assumed that | 87 // build time. Calling this function records UMA statistics: it's assumed that |
53 // it's called in the course of handling an SSL error. | 88 // it's called in the course of handling an SSL error. |
54 ClockState GetClockState( | 89 ClockState GetClockState( |
55 const base::Time& now_system, | 90 const base::Time& now_system, |
56 const network_time::NetworkTimeTracker* network_time_tracker); | 91 const network_time::NetworkTimeTracker* network_time_tracker); |
57 | 92 |
58 // Returns true if |hostname| is too broad for the scope of a wildcard | 93 // Returns true if |hostname| is too broad for the scope of a wildcard |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // appspot.com. | 165 // appspot.com. |
131 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, | 166 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, |
132 const HostnameTokens& parent); | 167 const HostnameTokens& parent); |
133 | 168 |
134 // Exposed for teshting. | 169 // Exposed for teshting. |
135 size_t GetLevenshteinDistance(const std::string& str1, const std::string& str2); | 170 size_t GetLevenshteinDistance(const std::string& str1, const std::string& str2); |
136 | 171 |
137 } // namespace ssl_errors | 172 } // namespace ssl_errors |
138 | 173 |
139 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 174 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
OLD | NEW |