| 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 "chrome/browser/ssl/chrome_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 11 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 12 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" | 12 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "content/public/browser/cert_store.h" | 14 #include "content/public/browser/cert_store.h" |
| 15 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/origin_util.h" | 17 #include "content/public/common/origin_util.h" |
| 18 #include "content/public/common/ssl_status.h" | 18 #include "content/public/common/ssl_status.h" |
| 19 #include "net/cert/x509_certificate.h" | 19 #include "net/cert/x509_certificate.h" |
| 20 | 20 |
| 21 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeSecurityStateModelClient); | 21 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeSecurityStateModelClient); |
| 22 | 22 |
| 23 using security_state::SecurityStateModel; |
| 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 // Converts a content::SecurityStyle (an indicator of a request's | 27 // Converts a content::SecurityStyle (an indicator of a request's |
| 26 // overall security level computed by //content) into a | 28 // overall security level computed by //content) into a |
| 27 // SecurityStateModel::SecurityLevel (a finer-grained SecurityStateModel | 29 // SecurityStateModel::SecurityLevel (a finer-grained SecurityStateModel |
| 28 // concept that can express all of SecurityStateModel's policies that | 30 // concept that can express all of SecurityStateModel's policies that |
| 29 // //content doesn't necessarily know about). | 31 // //content doesn't necessarily know about). |
| 30 SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle( | 32 SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle( |
| 31 content::SecurityStyle style) { | 33 content::SecurityStyle style) { |
| 32 switch (style) { | 34 switch (style) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 for (const auto& sct : ssl.signed_certificate_timestamp_ids) | 113 for (const auto& sct : ssl.signed_certificate_timestamp_ids) |
| 112 state->sct_verify_statuses.push_back(sct.status); | 114 state->sct_verify_statuses.push_back(sct.status); |
| 113 state->displayed_mixed_content = | 115 state->displayed_mixed_content = |
| 114 (ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT) | 116 (ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT) |
| 115 ? true | 117 ? true |
| 116 : false; | 118 : false; |
| 117 state->ran_mixed_content = | 119 state->ran_mixed_content = |
| 118 (ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT) ? true | 120 (ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT) ? true |
| 119 : false; | 121 : false; |
| 120 } | 122 } |
| OLD | NEW |