| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "chrome/browser/ssl/ssl_error_classification.h" | 7 #include "chrome/browser/ssl/ssl_error_classification.h" |
| 8 | 8 |
| 9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Assume if captive portals are detected then the user is connected using a | 346 // Assume if captive portals are detected then the user is connected using a |
| 347 // hot spot. | 347 // hot spot. |
| 348 static const float kHotspotWeight = 0.2f; | 348 static const float kHotspotWeight = 0.2f; |
| 349 if (captive_portal_probe_completed_ && captive_portal_detected_) | 349 if (captive_portal_probe_completed_ && captive_portal_detected_) |
| 350 return kHotspotWeight; | 350 return kHotspotWeight; |
| 351 #endif | 351 #endif |
| 352 return kOtherWeight; | 352 return kOtherWeight; |
| 353 } | 353 } |
| 354 | 354 |
| 355 bool SSLErrorClassification::IsUserClockInThePast(const base::Time& time_now) { | 355 bool SSLErrorClassification::IsUserClockInThePast(const base::Time& time_now) { |
| 356 #if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD) |
| 357 return false; |
| 358 #else |
| 356 base::Time build_time = base::GetBuildTime(); | 359 base::Time build_time = base::GetBuildTime(); |
| 357 if (time_now < build_time - base::TimeDelta::FromDays(2)) | 360 if (time_now < build_time - base::TimeDelta::FromDays(2)) |
| 358 return true; | 361 return true; |
| 359 return false; | 362 return false; |
| 363 #endif |
| 360 } | 364 } |
| 361 | 365 |
| 362 bool SSLErrorClassification::IsUserClockInTheFuture( | 366 bool SSLErrorClassification::IsUserClockInTheFuture( |
| 363 const base::Time& time_now) { | 367 const base::Time& time_now) { |
| 368 #if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD) |
| 369 return false; |
| 370 #else |
| 364 base::Time build_time = base::GetBuildTime(); | 371 base::Time build_time = base::GetBuildTime(); |
| 365 if (time_now > build_time + base::TimeDelta::FromDays(365)) | 372 if (time_now > build_time + base::TimeDelta::FromDays(365)) |
| 366 return true; | 373 return true; |
| 367 return false; | 374 return false; |
| 375 #endif |
| 368 } | 376 } |
| 369 | 377 |
| 370 bool SSLErrorClassification::MaybeWindowsLacksSHA256Support() { | 378 bool SSLErrorClassification::MaybeWindowsLacksSHA256Support() { |
| 371 #if defined(OS_WIN) | 379 #if defined(OS_WIN) |
| 372 return !base::win::MaybeHasSHA256Support(); | 380 return !base::win::MaybeHasSHA256Support(); |
| 373 #else | 381 #else |
| 374 return false; | 382 return false; |
| 375 #endif | 383 #endif |
| 376 } | 384 } |
| 377 | 385 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // sure we don't clear the captive protal flag, since the interstitial was | 601 // sure we don't clear the captive protal flag, since the interstitial was |
| 594 // potentially caused by the captive portal. | 602 // potentially caused by the captive portal. |
| 595 captive_portal_detected_ = captive_portal_detected_ || | 603 captive_portal_detected_ = captive_portal_detected_ || |
| 596 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 604 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
| 597 // Also keep track of non-HTTP portals and error cases. | 605 // Also keep track of non-HTTP portals and error cases. |
| 598 captive_portal_no_response_ = captive_portal_no_response_ || | 606 captive_portal_no_response_ = captive_portal_no_response_ || |
| 599 (results->result == captive_portal::RESULT_NO_RESPONSE); | 607 (results->result == captive_portal::RESULT_NO_RESPONSE); |
| 600 } | 608 } |
| 601 #endif | 609 #endif |
| 602 } | 610 } |
| OLD | NEW |