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 #include "components/ssl_errors/error_classification.h" | 5 #include "components/ssl_errors/error_classification.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.connection_type", | 211 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.connection_type", |
212 net::NetworkChangeNotifier::GetConnectionType(), | 212 net::NetworkChangeNotifier::GetConnectionType(), |
213 net::NetworkChangeNotifier::CONNECTION_LAST); | 213 net::NetworkChangeNotifier::CONNECTION_LAST); |
214 } | 214 } |
215 | 215 |
216 bool IsUserClockInThePast(const base::Time& time_now) { | 216 bool IsUserClockInThePast(const base::Time& time_now) { |
217 base::Time build_time; | 217 base::Time build_time; |
218 if (!g_testing_build_time.Get().is_null()) { | 218 if (!g_testing_build_time.Get().is_null()) { |
219 build_time = g_testing_build_time.Get(); | 219 build_time = g_testing_build_time.Get(); |
220 } else { | 220 } else { |
221 #if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD) | |
222 return false; | |
223 #else | |
224 build_time = base::GetBuildTime(); | 221 build_time = base::GetBuildTime(); |
225 #endif | |
226 } | 222 } |
227 | 223 |
228 if (time_now < build_time - base::TimeDelta::FromDays(2)) | 224 if (time_now < build_time - base::TimeDelta::FromDays(2)) |
229 return true; | 225 return true; |
230 return false; | 226 return false; |
231 } | 227 } |
232 | 228 |
233 bool IsUserClockInTheFuture(const base::Time& time_now) { | 229 bool IsUserClockInTheFuture(const base::Time& time_now) { |
234 base::Time build_time; | 230 base::Time build_time; |
235 if (!g_testing_build_time.Get().is_null()) { | 231 if (!g_testing_build_time.Get().is_null()) { |
236 build_time = g_testing_build_time.Get(); | 232 build_time = g_testing_build_time.Get(); |
237 } else { | 233 } else { |
238 #if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD) | |
239 return false; | |
240 #else | |
241 build_time = base::GetBuildTime(); | 234 build_time = base::GetBuildTime(); |
242 #endif | |
243 } | 235 } |
244 | 236 |
245 if (time_now > build_time + base::TimeDelta::FromDays(365)) | 237 if (time_now > build_time + base::TimeDelta::FromDays(365)) |
246 return true; | 238 return true; |
247 return false; | 239 return false; |
248 } | 240 } |
249 | 241 |
250 void SetBuildTimeForTesting(const base::Time& testing_time) { | 242 void SetBuildTimeForTesting(const base::Time& testing_time) { |
251 g_testing_build_time.Get() = testing_time; | 243 g_testing_build_time.Get() = testing_time; |
252 } | 244 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, | 414 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, |
423 host_name_domain) != dns_names_domain.end() - 1; | 415 host_name_domain) != dns_names_domain.end() - 1; |
424 } | 416 } |
425 | 417 |
426 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { | 418 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { |
427 return net::IsHostnameNonUnique(hostname) || | 419 return net::IsHostnameNonUnique(hostname) || |
428 hostname.find('.') == std::string::npos; | 420 hostname.find('.') == std::string::npos; |
429 } | 421 } |
430 | 422 |
431 } // namespace ssl_errors | 423 } // namespace ssl_errors |
OLD | NEW |