Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: chrome/browser/ssl/ssl_error_classification.cc

Issue 695523002: Change dont_embed_build_metadata default to 1 except for Official build and fix some unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the logic in ssl_error_classification.cc Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/common.gypi ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698