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(OFFICIAL_BUILD) | |
M-A Ruel
2014/10/30 21:09:07
Why not use for consistency?
#if defined(DONT_EMBE
Sébastien Marchand
2014/10/30 21:14:05
Done.
| |
356 base::Time build_time = base::GetBuildTime(); | 357 base::Time build_time = base::GetBuildTime(); |
357 if (time_now < build_time - base::TimeDelta::FromDays(2)) | 358 if (time_now < build_time - base::TimeDelta::FromDays(2)) |
358 return true; | 359 return true; |
360 #endif | |
359 return false; | 361 return false; |
360 } | 362 } |
361 | 363 |
362 bool SSLErrorClassification::IsUserClockInTheFuture( | 364 bool SSLErrorClassification::IsUserClockInTheFuture( |
363 const base::Time& time_now) { | 365 const base::Time& time_now) { |
366 #if defined(OFFICIAL_BUILD) | |
364 base::Time build_time = base::GetBuildTime(); | 367 base::Time build_time = base::GetBuildTime(); |
365 if (time_now > build_time + base::TimeDelta::FromDays(365)) | 368 if (time_now > build_time + base::TimeDelta::FromDays(365)) |
366 return true; | 369 return true; |
370 #endif | |
367 return false; | 371 return false; |
368 } | 372 } |
369 | 373 |
370 bool SSLErrorClassification::MaybeWindowsLacksSHA256Support() { | 374 bool SSLErrorClassification::MaybeWindowsLacksSHA256Support() { |
371 #if defined(OS_WIN) | 375 #if defined(OS_WIN) |
372 return !base::win::MaybeHasSHA256Support(); | 376 return !base::win::MaybeHasSHA256Support(); |
373 #else | 377 #else |
374 return false; | 378 return false; |
375 #endif | 379 #endif |
376 } | 380 } |
(...skipping 216 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 | 597 // sure we don't clear the captive protal flag, since the interstitial was |
594 // potentially caused by the captive portal. | 598 // potentially caused by the captive portal. |
595 captive_portal_detected_ = captive_portal_detected_ || | 599 captive_portal_detected_ = captive_portal_detected_ || |
596 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 600 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
597 // Also keep track of non-HTTP portals and error cases. | 601 // Also keep track of non-HTTP portals and error cases. |
598 captive_portal_no_response_ = captive_portal_no_response_ || | 602 captive_portal_no_response_ = captive_portal_no_response_ || |
599 (results->result == captive_portal::RESULT_NO_RESPONSE); | 603 (results->result == captive_portal::RESULT_NO_RESPONSE); |
600 } | 604 } |
601 #endif | 605 #endif |
602 } | 606 } |
OLD | NEW |