Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.connection_type", | 205 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.connection_type", |
| 206 net::NetworkChangeNotifier::GetConnectionType(), | 206 net::NetworkChangeNotifier::GetConnectionType(), |
| 207 net::NetworkChangeNotifier::CONNECTION_LAST); | 207 net::NetworkChangeNotifier::CONNECTION_LAST); |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool IsUserClockInThePast(const base::Time& time_now) { | 210 bool IsUserClockInThePast(const base::Time& time_now) { |
| 211 base::Time build_time; | 211 base::Time build_time; |
| 212 if (!g_testing_build_time.Get().is_null()) { | 212 if (!g_testing_build_time.Get().is_null()) { |
| 213 build_time = g_testing_build_time.Get(); | 213 build_time = g_testing_build_time.Get(); |
| 214 } else { | 214 } else { |
| 215 #if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD) | |
|
agl
2016/01/29 21:46:46
This (and below) needs careful consideration about
| |
| 216 return false; | |
| 217 #else | |
| 218 build_time = base::GetBuildTime(); | 215 build_time = base::GetBuildTime(); |
| 219 #endif | |
| 220 } | 216 } |
| 221 | 217 |
| 222 if (time_now < build_time - base::TimeDelta::FromDays(2)) | 218 if (time_now < build_time - base::TimeDelta::FromDays(2)) |
| 223 return true; | 219 return true; |
| 224 return false; | 220 return false; |
| 225 } | 221 } |
| 226 | 222 |
| 227 bool IsUserClockInTheFuture(const base::Time& time_now) { | 223 bool IsUserClockInTheFuture(const base::Time& time_now) { |
| 228 base::Time build_time; | 224 base::Time build_time; |
| 229 if (!g_testing_build_time.Get().is_null()) { | 225 if (!g_testing_build_time.Get().is_null()) { |
| 230 build_time = g_testing_build_time.Get(); | 226 build_time = g_testing_build_time.Get(); |
| 231 } else { | 227 } else { |
| 232 #if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD) | |
| 233 return false; | |
| 234 #else | |
| 235 build_time = base::GetBuildTime(); | 228 build_time = base::GetBuildTime(); |
| 236 #endif | |
| 237 } | 229 } |
| 238 | 230 |
| 239 if (time_now > build_time + base::TimeDelta::FromDays(365)) | 231 if (time_now > build_time + base::TimeDelta::FromDays(365)) |
| 240 return true; | 232 return true; |
| 241 return false; | 233 return false; |
| 242 } | 234 } |
| 243 | 235 |
| 244 void SetBuildTimeForTesting(const base::Time& testing_time) { | 236 void SetBuildTimeForTesting(const base::Time& testing_time) { |
| 245 g_testing_build_time.Get() = testing_time; | 237 g_testing_build_time.Get() = testing_time; |
| 246 } | 238 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, | 408 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, |
| 417 host_name_domain) != dns_names_domain.end() - 1; | 409 host_name_domain) != dns_names_domain.end() - 1; |
| 418 } | 410 } |
| 419 | 411 |
| 420 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { | 412 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { |
| 421 return net::IsHostnameNonUnique(hostname) || | 413 return net::IsHostnameNonUnique(hostname) || |
| 422 hostname.find('.') == std::string::npos; | 414 hostname.find('.') == std::string::npos; |
| 423 } | 415 } |
| 424 | 416 |
| 425 } // namespace ssl_errors | 417 } // namespace ssl_errors |
| OLD | NEW |