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/security_state/security_state_model.h" | 5 #include "components/security_state/security_state_model.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "components/security_state/security_state_model_client.h" | 12 #include "components/security_state/security_state_model_client.h" |
| 13 #include "components/security_state/switches.h" | 13 #include "components/security_state/switches.h" |
| 14 #include "net/ssl/ssl_cipher_suite_names.h" | 14 #include "net/ssl/ssl_cipher_suite_names.h" |
| 15 #include "net/ssl/ssl_connection_status_flags.h" | 15 #include "net/ssl/ssl_connection_status_flags.h" |
| 16 | 16 |
| 17 namespace security_state { | 17 namespace security_state { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 SecurityStateModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial() { | 21 SecurityStateModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial() { |
| 22 std::string choice = | 22 std::string choice = |
| 23 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 23 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 24 switches::kMarkNonSecureAs); | 24 switches::kMarkHttpAs); |
| 25 std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); | 25 std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); |
| 26 | 26 |
| 27 // Do not change this enum. It is used in the histogram. | 27 // Do not change this enum. It is used in the histogram. |
| 28 enum MarkNonSecureStatus { NEUTRAL, DUBIOUS, NON_SECURE, LAST_STATUS }; | 28 enum MarkHttpStatus { NEUTRAL, DUBIOUS, NON_SECURE, LAST_STATUS }; |
|
estark
2016/09/22 23:53:53
Just a heads-up, I think this will either conflict
| |
| 29 const char kEnumeration[] = "MarkNonSecureAs"; | 29 const char kEnumeration[] = "MarkNonSecureAs"; |
| 30 | 30 |
| 31 SecurityStateModel::SecurityLevel level = SecurityStateModel::NONE; | 31 SecurityStateModel::SecurityLevel level = SecurityStateModel::NONE; |
| 32 MarkNonSecureStatus status; | 32 MarkHttpStatus status; |
| 33 | 33 |
| 34 if (choice == switches::kMarkNonSecureAsNeutral) { | 34 if (choice == switches::kMarkHttpAsNeutral) { |
| 35 status = NEUTRAL; | 35 status = NEUTRAL; |
| 36 level = SecurityStateModel::NONE; | 36 level = SecurityStateModel::NONE; |
| 37 } else if (choice == switches::kMarkNonSecureAsNonSecure) { | 37 } else if (choice == switches::kMarkHttpAsNonSecure) { |
| 38 status = NON_SECURE; | 38 status = NON_SECURE; |
| 39 level = SecurityStateModel::SECURITY_ERROR; | 39 level = SecurityStateModel::SECURITY_ERROR; |
| 40 } else if (group == switches::kMarkNonSecureAsNeutral || | 40 } else if (group == switches::kMarkHttpAsNeutral || |
| 41 group == switches::kMarkNonSecureWithPasswordsOrCcAsNonSecure) { | 41 group == switches::kMarkHttpWithPasswordsOrCcWithChip) { |
| 42 status = NEUTRAL; | 42 status = NEUTRAL; |
| 43 level = SecurityStateModel::NONE; | 43 level = SecurityStateModel::NONE; |
| 44 } else if (group == switches::kMarkNonSecureAsNonSecure) { | 44 } else if (group == switches::kMarkHttpAsNonSecure) { |
| 45 status = NON_SECURE; | 45 status = NON_SECURE; |
| 46 level = SecurityStateModel::SECURITY_ERROR; | 46 level = SecurityStateModel::SECURITY_ERROR; |
| 47 } else { | 47 } else { |
| 48 status = NEUTRAL; | 48 status = NEUTRAL; |
| 49 level = SecurityStateModel::NONE; | 49 level = SecurityStateModel::NONE; |
| 50 } | 50 } |
| 51 | 51 |
| 52 UMA_HISTOGRAM_ENUMERATION(kEnumeration, status, LAST_STATUS); | 52 UMA_HISTOGRAM_ENUMERATION(kEnumeration, status, LAST_STATUS); |
| 53 return level; | 53 return level; |
| 54 } | 54 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 sct_verify_statuses == other.sct_verify_statuses && | 315 sct_verify_statuses == other.sct_verify_statuses && |
| 316 displayed_mixed_content == other.displayed_mixed_content && | 316 displayed_mixed_content == other.displayed_mixed_content && |
| 317 ran_mixed_content == other.ran_mixed_content && | 317 ran_mixed_content == other.ran_mixed_content && |
| 318 displayed_content_with_cert_errors == | 318 displayed_content_with_cert_errors == |
| 319 other.displayed_content_with_cert_errors && | 319 other.displayed_content_with_cert_errors && |
| 320 ran_content_with_cert_errors == other.ran_content_with_cert_errors && | 320 ran_content_with_cert_errors == other.ran_content_with_cert_errors && |
| 321 pkp_bypassed == other.pkp_bypassed); | 321 pkp_bypassed == other.pkp_bypassed); |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace security_state | 324 } // namespace security_state |
| OLD | NEW |